Here I have using javascript for adding html control(Input). here I am not able to apply asp.net control because it come dynamically from java script I just want to use input value in my coed behind page which is generated by javascript dynamically.
Is there any way to get value from HTML control in asp.net.
By using Request.Form["id"]` on Button_Click, you will get the value of html control
string id = Request.Form["id"]
You can access the form control without having runat="server"
you need to do following
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"];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With