简体   繁体   English

样式asp按钮看起来像带有Jquery-ui的Jquery按钮

[英]style asp button to look like Jquery button with Jquery-ui

I don't want to call .button() on my asp:button, I just want to add some classes from the JqueryUI if possible. 我不想在我的asp:button上调用.button(),我只想尽可能从JqueryUI添加一些类。

I was thinking just adding the class ui-button to the asp:button 我在想只是将类ui-button添加到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? 有任何想法吗?

将CSS样式ui-state-default ui-corner-all ui-button-text-only到您的按钮。

ui-button won't give it a button look exactly. ui-button不会给它一个按钮外观。 Take a look at what ui-button contains: 看一下ui-button包含的内容:

.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: 为了制作一个jQuery样式的按钮,您必须添加以下内容:

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 还要加载以下CSS: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css : http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css

使用CssClass而不只是class

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. 在上面提到的Naveed帽子上可以找到所需的真实课程。

    <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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM