You can access the control without having runat="server" , which you need to execute
- The form method must be of type POST.
- The tag must have the attribute NAME. Because it is used as a key in the form of [].
- The Html control must have access in code.
Html
<form id="form1" runat="server" > <input type="text" name="txtName" value="hidden text" /> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> </form>
C # code:
protected void Button1_Click(object sender, EventArgs e) { string s = Page.Request.Form["txtName"]; }
source share