1

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?

1
  • 1
    surely this is such basic stuff, a first tutorial would cover it? Commented Nov 4, 2012 at 23:51

1 Answer 1

3

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";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.