Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Retrieving form data by name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
andrewbb@gmail.com - 06 Jul 2007 03:21 GMT
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>
Sergey Poberezovskiy - 06 Jul 2007 06:12 GMT
You could read your value as
txtName.Text
or
Me.Request.Form.Item(txtName.ClientID)

> This will likely be the dumbest question of the day, but:
>
[quoted text clipped - 25 lines]
>                 <asp:TextBox ID="txtEmail" runat="server"
> MaxLength="50" Width="264px"></asp:TextBox></td>
andrewbb@gmail.com - 06 Jul 2007 07:53 GMT
Aidy - 06 Jul 2007 11:23 GMT
Or just use

txtName.Text

if viewstate is enabled.

> You could read your value as
> txtName.Text
[quoted text clipped - 30 lines]
>>                 <asp:TextBox ID="txtEmail" runat="server"
>> MaxLength="50" Width="264px"></asp:TextBox></td>
Milosz Skalecki [MCAD] - 06 Jul 2007 11:44 GMT
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

> Or just use
>
[quoted text clipped - 36 lines]
> >>                 <asp:TextBox ID="txtEmail" runat="server"
> >> MaxLength="50" Width="264px"></asp:TextBox></td>
Aidy - 06 Jul 2007 12:53 GMT
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

> Howdy Aidy,
>
[quoted text clipped - 48 lines]
>> >>                 <asp:TextBox ID="txtEmail" runat="server"
>> >> MaxLength="50" Width="264px"></asp:TextBox></td>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.