[英]twitter bootstrap, html controls and asp.net code behind
I am working on a website developed using the twitter bootstrap and asp.net. 我正在使用twitter bootstrap和asp.net开发的网站上工作。
I would like to know how to access a html control from the code behind page. 我想知道如何从代码隐藏页面访问html控件。 For example,
例如,
<div class="control-group">
<label class="control-label" for="name">
Your Name</label>
<div class="controls">
<input type="text" class="input-xlarge" name="ApplicantName" id="AppName" placeholder="First Name and Last Name" >
</div>
</div>
How do I get or set the value of the ApplicantName textbox? 如何获取或设置ApplicantName文本框的值?
Add a runat
attribute to the control and set the value as server
and it will be accessible in codebehind. 向控件添加
runat
属性并将值设置为server
并且可以在代码隐藏中访问它。
<input type="text" id="txtName" runat="server" />
Now in codebehind, you can access it. 现在在代码隐藏中,您可以访问它。
txtName.Value="this is set from codebehind";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.