Retrieving form data by name

  • Thread starter Thread starter andrewbb
  • Start date Start date
A

andrewbb

This will likely be the dumbest question of the day, but:

Me.Request.Form.Item(3) 'works
Me.Request.Form.Item("txtName") 'doesn't work

Intellisense shows the full name of the key is:
ctl00$ContentPlaceHolder1$txtName

Why is the key not: txtName ?

Master:
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder
ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>

Page:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<table style="width: 500px; height: 200px">
<tr>
<td style="width: auto;">
Email address:</td>
<td style="width: 192px;">
<asp:TextBox ID="txtEmail" runat="server"
MaxLength="50" Width="264px"></asp:TextBox></td>
 
Howdy Aidy,

Why if viewstate is enabled? It works even if ViewState is disabled, because
it's equivalent to Request.Form[txt.UniqueID]. TextBox uses viewstate only to
raise OnTextChanged event.

Regards
 
I have to admit as I was typing I doubted that you needed the viewstate
enabled. As you said, it is needed for comparisons for raising events and
seld-populating but no much else

Milosz Skalecki said:
Howdy Aidy,

Why if viewstate is enabled? It works even if ViewState is disabled,
because
it's equivalent to Request.Form[txt.UniqueID]. TextBox uses viewstate only
to
raise OnTextChanged event.

Regards
--
Milosz


Aidy said:
Or just use

txtName.Text

if viewstate is enabled.

"Sergey Poberezovskiy" <[email protected]>
wrote
in message news:[email protected]...
 
Back
Top