Html 将引导程序元素添加到 asp 文本框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24112965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding bootstrap elements to asp textbox
提问by marchemike
I'm fairly new in asp.net, and I am more proficient at building html/php websites.I am trying to add twitter bootstrap to my textboxes. My current textbox shows:
我在 asp.net 中相当新,而且我更擅长构建 html/php 网站。我正在尝试将 twitter bootstrap 添加到我的文本框。我当前的文本框显示:
<asp:TextBox ID="UserName" runat="server" Width="250px" TabIndex="1"></asp:TextBox>
And the input that I designed using html is:
我使用 html 设计的输入是:
<input type="text" class="form-control input-lg" placeholder="Username">
How do I put all the classes of my textbox to my asp textbox, and would it take effect in a similar way html elements work?
如何将我的文本框的所有类放入我的 asp 文本框,它是否会以类似的 html 元素工作方式生效?
回答by ????
You can put these classes in asp textbox
using CssClass
as follows
您可以按如下方式asp textbox
使用这些类CssClass
<asp:TextBox ID="UserName" runat="server" CssClass="form-control input-lg"
Width="250px" TabIndex="1"></asp:TextBox>
Basically when you create a control asp control
it render as a html control on the browser.
So in the browser you will see the same.
基本上,当您创建控件时,asp control
它会在浏览器上呈现为 html 控件。
所以在浏览器中你会看到相同的内容。
There may be difference in the id
and the name
of the control. As they are generated depending on the controls like master page
and user controls
.
控件的id
和可能存在差异name
。因为它们取决于像控件生成master page
和user controls
。
Though you have different ClientIdMode
in asp.net to overcome this issue.
MSDN for the same is http://msdn.microsoft.com/en-us/library/system.web.ui.clientidmode.aspx
尽管您ClientIdMode
在 asp.net 中有不同的方法来克服这个问题。
相同的 MSDN 是http://msdn.microsoft.com/en-us/library/system.web.ui.clientidmode.aspx
回答by sakir
<asp:TextBox ID="UserName" runat="server" CssClass="form-control input-lg"
Width="250px" TabIndex="1" placeholder="Username"></asp:TextBox>