【问题标题】:twitter bootstrap, html controls and asp.net code behindtwitter bootstrap、html 控件和 asp.net 代码
【发布时间】:2023-04-01 09:05:01
【问题描述】:

我正在开发一个使用 twitter bootstrap 和 asp.net 开发的网站。

我想知道如何从页面后面的代码访问 html 控件。 例如,

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

如何获取或设置申请人姓名文本框的值?

【问题讨论】:

  • 当然这是基本的东西,第一个教程会涵盖它吗?

标签: c# asp.net html


【解决方案1】:

为控件添加runat属性并将值设置为server,它将可以在代码隐藏中访问。

<input type="text" id="txtName" runat="server" />

现在在代码隐藏中,您可以访问它。

txtName.Value="this is set from codebehind";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-21
    • 2016-10-30
    相关资源
    最近更新 更多