3

I have an Asp.Net button and I am applying flick theme to my buttons and it's applying to it but on mouse hovering it doesn't change the colour.

Here is what I am doing?May be I am wrong Can anyone guide me through this as I am able to work with normal html button by using

<button>Click Me!</button>

This is how I am working with Asp.net button:

<asp:Button ID="Button1" runat="server" Text="Click Me!" CssClass="ui-button ui-state-default"/> 
2
  • jQuery UI's button doesn't work with input type="submit" or input type="button", only the semantic button element. If you only want to apply the styles, you can refer to an ASP.NET element by using the 'ends-in' selector: $('input[id$="Button1"]') Commented Oct 10, 2011 at 17:23
  • Thanks for your reply and I have changed by simple adding a script tag (#btnSample).button;And in the code view i have removed my CssClass and changed it to <asp:button ID="btnSample></asp:button> and got working perfectly. Commented Oct 10, 2011 at 17:27

4 Answers 4

5

In ASP.NET the ID get's transformed so you can't pass it as a selector. You could probably use a class instead.

So instead of

$('#Button1').button();

use

$('.MyButtonStyle').button();

EDIT:

BTW, you shouldn't be adding any jquery-ui classes to the button manually (your example looks like that's what you are doing). This is all done by the .js file included with jquery ui

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your reply and actually still I couldn't get through your answer well I have changed in my script to $('MyButtonStyle').button; and Still I have the same problem.
I got it working and changed the code and will post the answer soon.
If you need to use the id in the selector for ASP controls do this: $('[id$=myButtonIDGoesHere]')
0

Anyways I found the answer and here is what I have did and worked well!

<script type="text/javascript">    
$('#btnSample').button();
</script>

Code for displaying:

 <asp:Button ID="btnSample" runat="server" Text="Click Me!"/>

Comments

0

try to set button property as

ClientIDMode="Static"

Then

Comments

0

man its easy , just add the following and it will work just fine :

    $(function () {
      $("input[type=submit]").button();
    });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.