Can we set form field in Asp.net

K

Karl Seguin

You can still use Request.Form

but typically you'd used a web control, such as an <asp:textbox id="name"
runat="server" />

and just access the value via name.Text

Karl
 
A

ad

Thank,
I have a some purpose, so I must use Request.Form to get some value.
I have tried below codes:

in a button's onClick event
TextBox1.Text="Hellow";

in the FormLoad event:
string myString = Request.Form["TextBox1"];
Label1.Text = myString;

But the the myString return null.

How can I do that?
 
K

Karl Seguin

two things...
Setting the text property of the textbox doesn't put the value in the
request.form...

and FormLoad happens BEFORE OnClick...so setting the the text in the button
click, even if it did set the value in request.form, would do so after
page_load fired...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)


ad said:
Thank,
I have a some purpose, so I must use Request.Form to get some value.
I have tried below codes:

in a button's onClick event
TextBox1.Text="Hellow";

in the FormLoad event:
string myString = Request.Form["TextBox1"];
Label1.Text = myString;

But the the myString return null.

How can I do that?





"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
¼¶¼g
©ó¶l¥ó·s»D:eD0N4P#[email protected]...
You can still use Request.Form

but typically you'd used a web control, such as an <asp:textbox id="name"
runat="server" />

and just access the value via name.Text

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top