How to get value in html control on postback in asp.net

I have an html control (not a server control) like textarea. How can I get the value in this control from the server side when I call the postback by clicking on the button without writing the value to the URL.

+3
source share
3 answers

You will need to reference the Form object.

If you have a text box like

<input type="text" id="txt" name="txt" value="Testing 1 2 3..."/>

Then you can access this in your code like this ...

Request.Form["txt"]
+16
source

You can add the runat = "server" attribute to the HTML controls.

, .

, , HTML , .

HTML- runat = "server"

+1

, - asmx. , . - javascript. , runat = server , - , .

0

Source: https://habr.com/ru/post/1762770/


All Articles