Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problem retrieving value via Request.Form

Reply
Thread Tools

Problem retrieving value via Request.Form

 
 
Chico
Guest
Posts: n/a
 
      06-03-2005
Hi,

I have the following code in my form:

Response.Write("<form name='Testing'>");
Response.Write("<INPUT type=hidden id='Testing_txtbox'
name='Testing_txtbox' value='a simple test'>");
Response.Write("</form>");

If I type the following in the very next line, I get a value of
"undefined".

Response.Write("value="+Request.Form("Testing_txtb ox"));

Can anyone tell me why this won't work. If it can't can anyone tell
me how I can retrieve values of hidden controls via Server side code?

Thanks

 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      06-03-2005
That value won't exist in the Request.Form collection until it is posted by
the client back to the server. "<input type=hidden..." is merely a string
that is being sent back in the response. It has no ties to Request.Form.
That comes from when the visitor of your page submits a form. Then the form
collection will have something called Testing_txtbox.

Ray at work

"Chico" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have the following code in my form:
>
> Response.Write("<form name='Testing'>");
> Response.Write("<INPUT type=hidden id='Testing_txtbox'
> name='Testing_txtbox' value='a simple test'>");
> Response.Write("</form>");
>
> If I type the following in the very next line, I get a value of
> "undefined".
>
> Response.Write("value="+Request.Form("Testing_txtb ox"));
>
> Can anyone tell me why this won't work. If it can't can anyone tell
> me how I can retrieve values of hidden controls via Server side code?
>
> Thanks
>



 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      06-03-2005
Add method="post" to your form tag. By default it uses the GET method (ie
uses the querystring) and the form collection is empty...

(you'll likely have also to change the logic as this value is available only
once the user entered something and submitted the form, not during the
initial display).

Patrice

--

"Chico" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> Hi,
>
> I have the following code in my form:
>
> Response.Write("<form name='Testing'>");
> Response.Write("<INPUT type=hidden id='Testing_txtbox'
> name='Testing_txtbox' value='a simple test'>");
> Response.Write("</form>");
>
> If I type the following in the very next line, I get a value of
> "undefined".
>
> Response.Write("value="+Request.Form("Testing_txtb ox"));
>
> Can anyone tell me why this won't work. If it can't can anyone tell
> me how I can retrieve values of hidden controls via Server side code?
>
> Thanks
>



 
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
Problem with retrieving the selected value in a dropdown list yasodhai@gmail.com ASP .Net 2 03-09-2007 01:16 PM
Problem with retrieving the selected value in a dropdown list yasodhai@gmail.com ASP .Net Datagrid Control 0 03-09-2007 07:16 AM
Problem Retrieving Cell Value From Datagrid Iain ASP .Net 2 01-22-2007 01:18 PM
Word: Retrieving summary information via command line. Alex Vinokur Computer Support 0 03-23-2005 12:18 PM
Retrieving a HTML Element's Value via Request.Params Praveen ASP .Net 6 03-01-2005 12:41 PM



Advertisments