Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Retrieving form data by name

Reply
Thread Tools

Retrieving form data by name

 
 
andrewbb@gmail.com
Guest
Posts: n/a
 
      07-06-2007
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>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=
Guest
Posts: n/a
 
      07-06-2007
You could read your value as
txtName.Text
or
Me.Request.Form.Item(txtName.ClientID)

"(E-Mail Removed)" wrote:

> 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>
>
>

 
Reply With Quote
 
 
 
 
andrewbb@gmail.com
Guest
Posts: n/a
 
      07-06-2007
Thanks!

 
Reply With Quote
 
Aidy
Guest
Posts: n/a
 
      07-06-2007
Or just use

txtName.Text

if viewstate is enabled.

"Sergey Poberezovskiy" <(E-Mail Removed)> wrote
in message news:(E-Mail Removed)...
> You could read your value as
> txtName.Text
> or
> Me.Request.Form.Item(txtName.ClientID)
>
> "(E-Mail Removed)" wrote:
>
>> 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>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      07-06-2007
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" wrote:

> Or just use
>
> txtName.Text
>
> if viewstate is enabled.
>
> "Sergey Poberezovskiy" <(E-Mail Removed)> wrote
> in message news:(E-Mail Removed)...
> > You could read your value as
> > txtName.Text
> > or
> > Me.Request.Form.Item(txtName.ClientID)
> >
> > "(E-Mail Removed)" wrote:
> >
> >> 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>
> >>
> >>

>
>
>

 
Reply With Quote
 
Aidy
Guest
Posts: n/a
 
      07-06-2007
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 [MCAD]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" wrote:
>
>> Or just use
>>
>> txtName.Text
>>
>> if viewstate is enabled.
>>
>> "Sergey Poberezovskiy" <(E-Mail Removed)>
>> wrote
>> in message news:(E-Mail Removed)...
>> > You could read your value as
>> > txtName.Text
>> > or
>> > Me.Request.Form.Item(txtName.ClientID)
>> >
>> > "(E-Mail Removed)" wrote:
>> >
>> >> 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>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i retrieve the name of form when one of the element name in this form is 'name' ashok.dhananjeyan@gmail.com Javascript 6 11-24-2006 02:54 AM
Hibernate question: retrieving class name and field name from table_name and column_name hstanciu@yahoo.com Java 3 11-22-2006 06:07 PM
Read form "name" attribute when it contains form field with name "name" Pavils Jurjans Javascript 3 03-18-2005 01:39 PM
retrieving data from a form Dan DeConinck of PixelSmart HTML 2 08-29-2004 11:26 AM
IE name="name" & form.name property bug Java script Dude Javascript 5 06-30-2004 03:07 AM



Advertisments