Can we set form field in Asp.net

  • Thread starter Thread starter ad
  • Start date Start date
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
 
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?
 
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!)
 
Back
Top