0

I don't want to call .button() on my asp:button, I just want to add some classes from the JqueryUI if possible.

I was thinking just adding the class ui-button to the asp:button

<asp:button class="ui-button" runat="server" id="TrackRequestSearch" Text="Search" 
        onclick="TrackRequestSearch_Click"></asp:button>

but this does not work.

Any ideas?

1
  • A suitable alternitive would be to use a regular html button and somehow fire the server side on click method, but i'm not sure that can be done easily... Commented Apr 20, 2011 at 11:29

5 Answers 5

1

Add CSS style ui-state-default ui-corner-all ui-button-text-only to your button.

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

Comments

1

ui-button won't give it a button look exactly. Take a look at what ui-button contains:

.ui-button {
display: inline-block;
position: relative;
padding: 0;
margin-right: .1em;
text-decoration: none !important;
cursor: pointer;
text-align: center;
zoom: 1;
overflow: visible;
}

In order to make a jQuery styled button you must add the following to it:

ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only

Also load the following CSS: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css

5 Comments

what class is being added on hover?
It's .ui-state-hover and .ui-state-focus
so that would be: $("#TrackRequestSearch").hover(function () { $(this).addClass("ui-state-hover").addClass("ui-state-focus"); }, function () { $(this).removeClass("ui-state-hover").removeClass("ui-state-focus"); }); and how about the style for the click?
Yes, that's how it should be.
do you know what the css classes are for the click style?
1

Use CssClass instead of just class

Comments

0
    <asp:button class="ui-button-text-icon ui-button ui-widget 
    ui-state-default ui-corner-all ui-button-text-only" 
    runat="server" id="TrackRequestSearch" Text="Search" 
onclick="TrackRequestSearch_Click"></asp:button>

2 Comments

This doesn't add in the hover style a button has however; so the hover must be an event that is added rather than a css class.
Or the style when the button is clicked for that matter
0

Add the following script(s)

$(":submit").addClass('ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'); // All buttons 

or

$('#<%= button1.ClientID %>').addClass('ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'); // My specific button

Tip of the hat to Naveed above for the true classes needed.

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.