What happened to the Request.Form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got the following code:

<%= "myText = " + Request.Form["myText"] %>
<form id="Form1" method="post" runat="server">

<input type="text" id="myText">
<input type="button" value="submit">
</form>

Using view->source in IE I see:

<form name="Form1" method="post" action="testform.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwxNzg0NjA0NTg0Ozs+i3a+vle2SX4KbtVWA04XJ100Y4s=" />


<input type="text" id="myText">
<input type="button" value="submit">
</form>

However you can't access myText in Request.Form when post back. Why isn't it
in Request.Form collection? Is it inside ViewState? Thanks, Moheb
 
It's still there, but it works on the name attribute (like it always has)

<input type="text" id="myText" name="myText" >

Karl
 
My bad. Haven't been working on non-server code for 2 years, thanks-Moheb

Karl said:
It's still there, but it works on the name attribute (like it always has)

<input type="text" id="myText" name="myText" >

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/


Moheb said:
I've got the following code:

<%= "myText = " + Request.Form["myText"] %>
<form id="Form1" method="post" runat="server">

<input type="text" id="myText">
<input type="button" value="submit">
</form>

Using view->source in IE I see:

<form name="Form1" method="post" action="testform.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE"
value="dDwxNzg0NjA0NTg0Ozs+i3a+vle2SX4KbtVWA04XJ100Y4s=" />


<input type="text" id="myText">
<input type="button" value="submit">
</form>

However you can't access myText in Request.Form when post back. Why isn't it
in Request.Form collection? Is it inside ViewState? Thanks, Moheb
 
Back
Top