access html control textbox element value at code behind access html control textbox element value at code behind how to access html control value. You can access the value of html element in web application code behind. The important thing to remember is the controls can be accessed at server side using it’s name property and not by ID of it. At client side you can access control by ID or name.

<input id="Text1" name="Text1" type="text" />

In code behind we will access the value of Text control Text1 by it’s name. Below snippet contains html textbox element and button control.

    <form id="form1" runat="server">
                <input id="Text1" name="Text1" type="text" />
                <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click1" />

On button click event page does post back and we retrieve the value stored in text control.

protected void Button1_Click1(object sender, EventArgs e)
   string inputValue = Request.Form["Text1"];

Request.Form can be used to access all controls on html page.

Note: Don’t forget to add name property value for html control.


How To Access Div, Iframe Html Controls Using code behindJQuery Set Value of Textbox or Label Control In Create Html ControlsGridview select emailJQuery access label control and set valuehtml without using tables tableless html table less html css tableless How to display HTML contentsJquery Dropdown Selected ValueHTML5 Slider control and monitor server JQuery Get .next() Element


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.