user1400396
user1400396

Reputation: 23

twitter bootstrap, html controls and asp.net code behind

I am working on a website developed using the twitter bootstrap and asp.net.

I would like to know how to access a html control from the code behind page. 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?

Upvotes: 1

Views: 2123

Answers (1)

Shyju
Shyju

Reputation: 218732

Add a runat attribute to the control and set the value as server and it will be accessible in codebehind.

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

Now in codebehind, you can access it.

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

Upvotes: 3

Related Questions