Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Request.Form in aspx


Message #1 by REdwards@c... on Fri, 12 Jul 2002 23:39:11
I am having trouble with a form. I have admin pages where a user can 
update a web page via a form. Everything works fine except that i want the 
user to be able to preview the final page. The form, of course, posts back 
so I put a Redirect() to the preview page in the btn_click. 

The preview page has a request.form but it isn't getting anything. What is 
the proper way to do this with aspx pages.

Also I have this code to put the form field into a variable:

  Dim strCaseNo As String
  strCaseNo = Request.Form("txtCaseNo")

but I get a compilation error "Declaration expected" on the second line.

What am I doing wrong...besides waking up this morning?
Message #2 by "jeby" <jeby@c...> on Mon, 15 Jul 2002 12:51:54 +0530
Request.form does not work in asp.net. You need to use session variables
and redirect the page to get the values posted in a different form.

-----Original Message-----
From: REdwards@c... [mailto:REdwards@c...]
Sent: Friday, July 12, 2002 11:39 PM
To: aspx_beginners
Subject: [aspx_beginners] Request.Form in aspx


I am having trouble with a form. I have admin pages where a user can
update a web page via a form. Everything works fine except that i want
the
user to be able to preview the final page. The form, of course, posts
back
so I put a Redirect() to the preview page in the btn_click.

The preview page has a request.form but it isn't getting anything. What
is
the proper way to do this with aspx pages.

Also I have this code to put the form field into a variable:

  Dim strCaseNo As String
  strCaseNo =3D Request.Form("txtCaseNo")

but I get a compilation error "Declaration expected" on the second line.

What am I doing wrong...besides waking up this morning?
Message #3 by "Naveen Avatapally" <naveen_av@h...> on Mon, 15 Jul 2002 09:58:58 -0400
Hi Jeby,
Can you send me a code sample with request.form, which demonstrates this 
functionality in ASP.NET?
There were a couple of e-mails in this list, but I am unable to figure out 
how to do it.
Any help will be appreciated.

Thanks,
Naveen.




>From: "jeby" <jeby@c...>
>Reply-To: "aspx_beginners" <aspx_beginners@p...>
>To: "aspx_beginners" <aspx_beginners@p...>
>Subject: [aspx_beginners] RE: Request.Form in aspx
>Date: Mon, 15 Jul 2002 12:51:54 +0530
>
>Request.form does not work in asp.net. You need to use session variables
>and redirect the page to get the values posted in a different form.
>
>-----Original Message-----
>From: REdwards@c... [mailto:REdwards@c...]
>Sent: Friday, July 12, 2002 11:39 PM
>To: aspx_beginners
>Subject: [aspx_beginners] Request.Form in aspx
>
>
>I am having trouble with a form. I have admin pages where a user can
>update a web page via a form. Everything works fine except that i want
>the
>user to be able to preview the final page. The form, of course, posts
>back
>so I put a Redirect() to the preview page in the btn_click.
>
>The preview page has a request.form but it isn't getting anything. What
>is
>the proper way to do this with aspx pages.
>
>Also I have this code to put the form field into a variable:
>
>   Dim strCaseNo As String
>   strCaseNo = Request.Form("txtCaseNo")
>
>but I get a compilation error "Declaration expected" on the second line.
>
>What am I doing wrong...besides waking up this morning?
>




------------------------------------------------------------
Naveen Avatapally
Graduate Student in Electrical/Computer Eng. Dept
Graduate Research Assistant in McTrans Center
1111 SW 16TH AVE # 99
Gainesville FL 32601 USA
Phone(R):(352)377-9295
http://www.avatapally.com
------------------------------------------------------------


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Message #4 by REdwards@c... on Mon, 15 Jul 2002 18:52:56
I'm still having trouble wrapping my head around this. In order to pass 
the value of the text box (in this case txtCaseNo.text) I have to create a 
session variable? I that done on the form page?  

I'm not exactly sure how to accomplish this. Do you have an example or can 
you point me to a resource?
Message #5 by "jeby" <jeby@c...> on Tue, 16 Jul 2002 12:26:47 +0530
Naveen,

You can try this.
In the First Page You have some fields that has to be captured in the
second page..

Do as we used to do in ASP, in the first page. Since we dont have
form.submit and form.action, submit to the same page (which is
automatic, you neednt write code for this!!!) and redirect the page to
the second one. (using Response.redirect("url") which is again same as
ASP).But before you could do this use session variables and assign the
values of the fields to them (you need to capture it in the second
page!) .

Thats it , you are done.
 try this sample code:


firstpage
session("EmpName") =3D txtEmp.text
session("EmpID") =3D txtID.text
response.redirect ("secondpage.aspx")

second page
response.write (session("EmpName"))

Hope you are clear

Regards,
Jeby

-----Original Message-----
From: Naveen Avatapally [mailto:naveen_av@h...]
Sent: Monday, July 15, 2002 7:29 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Request.Form in aspx


Hi Jeby,
Can you send me a code sample with request.form, which demonstrates this

functionality in ASP.NET?
There were a couple of e-mails in this list, but I am unable to figure
out
how to do it.
Any help will be appreciated.

Thanks,
Naveen.




>From: "jeby" <jeby@c...>
>Reply-To: "aspx_beginners" <aspx_beginners@p...>
>To: "aspx_beginners" <aspx_beginners@p...>
>Subject: [aspx_beginners] RE: Request.Form in aspx
>Date: Mon, 15 Jul 2002 12:51:54 +0530
>
>Request.form does not work in asp.net. You need to use session
variables
>and redirect the page to get the values posted in a different form.
>
>-----Original Message-----
>From: REdwards@c...
[mailto:REdwards@c...]
>Sent: Friday, July 12, 2002 11:39 PM
>To: aspx_beginners
>Subject: [aspx_beginners] Request.Form in aspx
>
>
>I am having trouble with a form. I have admin pages where a user can
>update a web page via a form. Everything works fine except that i want
>the
>user to be able to preview the final page. The form, of course, posts
>back
>so I put a Redirect() to the preview page in the btn_click.
>
>The preview page has a request.form but it isn't getting anything. What
>is
>the proper way to do this with aspx pages.
>
>Also I have this code to put the form field into a variable:
>
>   Dim strCaseNo As String
>   strCaseNo =3D Request.Form("txtCaseNo")
>
>but I get a compilation error "Declaration expected" on the second
line.
>
>What am I doing wrong...besides waking up this morning?
>




------------------------------------------------------------
Naveen Avatapally
Graduate Student in Electrical/Computer Eng. Dept
Graduate Research Assistant in McTrans Center
1111 SW 16TH AVE # 99
Gainesville FL 32601 USA
Phone(R):(352)377-9295
http://www.avatapally.com
------------------------------------------------------------


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Message #6 by "Naveen Avatapally" <naveen_av@h...> on Tue, 16 Jul 2002 11:44:53 -0400
Hi Jeby,
It worked great for me!
I also noticed that, when we use the session variables like
session("var")= textbox1.text , we can't use this statement to insert into 
SQL table.
So I am assigning the variables to form fields again and then using insert 
statement.
I appreciate your help.
Thanks,
Naveen.


>From: "jeby" <jeby@c...>
>Reply-To: "aspx_beginners" <aspx_beginners@p...>
>To: "aspx_beginners" <aspx_beginners@p...>
>Subject: [aspx_beginners] RE: Request.Form in aspx
>Date: Tue, 16 Jul 2002 12:26:47 +0530
>
>Naveen,
>
>You can try this.
>In the First Page You have some fields that has to be captured in the
>second page..
>
>Do as we used to do in ASP, in the first page. Since we dont have
>form.submit and form.action, submit to the same page (which is
>automatic, you neednt write code for this!!!) and redirect the page to
>the second one. (using Response.redirect("url") which is again same as
>ASP).But before you could do this use session variables and assign the
>values of the fields to them (you need to capture it in the second
>page!) .
>
>Thats it , you are done.
>  try this sample code:
>
>
>firstpage
>session("EmpName") = txtEmp.text
>session("EmpID") = txtID.text
>response.redirect ("secondpage.aspx")
>
>second page
>response.write (session("EmpName"))
>
>Hope you are clear
>
>Regards,
>Jeby
>
>-----Original Message-----
>From: Naveen Avatapally [mailto:naveen_av@h...]
>Sent: Monday, July 15, 2002 7:29 PM
>To: aspx_beginners
>Subject: [aspx_beginners] RE: Request.Form in aspx
>
>
>Hi Jeby,
>Can you send me a code sample with request.form, which demonstrates this
>
>functionality in ASP.NET?
>There were a couple of e-mails in this list, but I am unable to figure
>out
>how to do it.
>Any help will be appreciated.
>
>Thanks,
>Naveen.
>
>
>
>
> >From: "jeby" <jeby@c...>
> >Reply-To: "aspx_beginners" <aspx_beginners@p...>
> >To: "aspx_beginners" <aspx_beginners@p...>
> >Subject: [aspx_beginners] RE: Request.Form in aspx
> >Date: Mon, 15 Jul 2002 12:51:54 +0530
> >
> >Request.form does not work in asp.net. You need to use session
>variables
> >and redirect the page to get the values posted in a different form.
> >
> >-----Original Message-----
> >From: REdwards@c...
>[mailto:REdwards@c...]
> >Sent: Friday, July 12, 2002 11:39 PM
> >To: aspx_beginners
> >Subject: [aspx_beginners] Request.Form in aspx
> >
> >
> >I am having trouble with a form. I have admin pages where a user can
> >update a web page via a form. Everything works fine except that i want
> >the
> >user to be able to preview the final page. The form, of course, posts
> >back
> >so I put a Redirect() to the preview page in the btn_click.
> >
> >The preview page has a request.form but it isn't getting anything. What
> >is
> >the proper way to do this with aspx pages.
> >
> >Also I have this code to put the form field into a variable:
> >
> >   Dim strCaseNo As String
> >   strCaseNo = Request.Form("txtCaseNo")
> >
> >but I get a compilation error "Declaration expected" on the second
>line.
> >
> >What am I doing wrong...besides waking up this morning?
> >
>
>
>
>
>------------------------------------------------------------
>Naveen Avatapally
>Graduate Student in Electrical/Computer Eng. Dept
>Graduate Research Assistant in McTrans Center
>1111 SW 16TH AVE # 99
>Gainesville FL 32601 USA
>Phone(R):(352)377-9295
>http://www.avatapally.com
>------------------------------------------------------------
>
>
>_________________________________________________________________
>Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
>




------------------------------------------------------------
Naveen Avatapally
Graduate Student in Electrical/Computer Eng. Dept
Graduate Research Assistant in McTrans Center
1111 SW 16TH AVE # 99
Gainesville FL 32601 USA
Phone(R):(352)377-9295
http://www.avatapally.com
------------------------------------------------------------


_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

Message #7 by REdwards@c... on Tue, 16 Jul 2002 17:00:56
That is clear and thank you. I found out (through much searching) that 
there are several ways to do this. 

You can do it using Session (as you showed); by creating a class and using 
the HttpServerUtility.Transfer Methos. to pass the values (I ended up 
employing this method); and there is an article from MS that I haven't had 
time to read yet: http://support.microsoft.com/default.aspx?scid=kb;EN-
US;q303436

Hope this helps anyone who ends up doing a search for this type of 
information.
Message #8 by Pavankumar T <PavanKumar.T@k...> on Wed, 17 Jul 2002 10:26:10 +0530
This article talks about C#, can you please send that code for VB of using
this HTTPServerUtility.

Thanks in advance


-----Original Message-----
From: REdwards@c... [mailto:REdwards@c...]
Sent: Tuesday, July 16, 2002 10:31 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Request.Form in aspx


That is clear and thank you. I found out (through much searching) that 
there are several ways to do this. 

You can do it using Session (as you showed); by creating a class and using 
the HttpServerUtility.Transfer Methos. to pass the values (I ended up 
employing this method); and there is an article from MS that I haven't had 
time to read yet: http://support.microsoft.com/default.aspx?scid=kb;EN-
US;q303436

Hope this helps anyone who ends up doing a search for this type of 
information.
Message #9 by REdwards@c... on Fri, 19 Jul 2002 22:21:30
The url is: http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp?frame=true

  Return to Index