如何将一个引导Glyphicon一个asp里:按钮在ASP.Net? [英] How do I put a Bootstrap Glyphicon inside an asp:Button in ASP.Net?
问题描述
我在我的项目中使用引导3,我想用引导Glyphicons在ASP.net按钮。
I'm using Bootstrap 3 in my project, and I want to use Bootstrap Glyphicons in ASP.net buttons.
下面是code我用过,但它没有工作(我得到了它使用Twitter的引导样本<跨度>
而不是标记< I>
标签):
Here is the code I used, though it didn't work out (I got a sample which uses Twitter Bootstrap <span>
tags instead of <i>
tags):
<asp:Button ID="btnRandom"
runat="server"
Text="<span aria-hidden='true'
class='glyphicon glyphicon-refresh'>
</span>"
onclick="btnRandom_Click" />
也许额外的东西应该做的。
Maybe something extra should be done.
我怎样才能得到它的工作?在此先感谢您的答复。
How can I get it to work? Thanks in advance for the replies.
推荐答案
您必须使用 ASP:LinkButton的 而不是的一个 ASP:按钮,这里是如何使用自引导在ASP.NET Web应用程序的3 的工作对我来说:
You have to use asp:LinkButton instead of a asp:Button, here is how it works for me using Bootstrap 3 in an ASP.NET web-application:
从code可以做了以下工作:
From your code you can make the following work:
<asp:LinkButton ID="btnRandom"
runat="server"
CssClass="btn btn-primary"
OnClick="btnRandom_Click">
<span aria-hidden="true" class="glyphicon glyphicon-refresh"></span>
</asp:LinkButton>
下面是提交什么我使用了提交按钮带文本的,例如:
Here is an example of what I use for a Submit Button with text "Submit":
<asp:LinkButton ID="SubmitBtn"
runat="server"
CssClass="btn btn-primary"
OnClick="SubmitBtn_Click">
<span aria-hidden="true" class="glyphicon glyphicon-ok"></span>Submit
</asp:LinkButton>
这篇关于如何将一个引导Glyphicon一个asp里:按钮在ASP.Net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!