Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2005, 12:32 PM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default Passing variale from 1 form to another.

Is is possible to do it? Can anyone show me the way? thanks

 
Old July 7th, 2005, 01:13 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Place the variable into a session variable.

 
Old July 8th, 2005, 06:03 AM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default

Hi,

   In asp.net if u want to pass a variable from one page to another page it is better to use response.redirect method or sessions or cookies.

   using response.redirect
response.redirect("page2.aspx?var1="<value of variable such as textbox1.text or 56>)

in page 2 use the following code to retrive the value

   if request.querystring("var1")="" then
   'checking for null value
   response.redirect("page1.aspx")
   else
   variable2=request.querystring("var1")
   endif
   now the value you passed from page 1 is in variable2

   ok same way u can use session variables also
  in page1.aspx
  session("var1")=textbox1.text or "56"

  in page2.aspx
  variable2=session("var1")
  'now variable2 contains the value
  i am not good at cookies so i am not mentioning here.

Hope this Helps-Ashok Parchuri
 
Old July 8th, 2005, 09:22 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

As Ashok stated, cookies are also an option, but that depends on your application, internet or intranet, persistance of cookies. However for simplicity, his examples will work fine.

 
Old July 8th, 2005, 12:25 PM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks a lot ashokparchuri..It works great with the session variable.

 
Old July 9th, 2005, 11:56 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default

i try the response.redirect as taught by but it can't work? is it missing out something like "?the code is as following as following

response.redirect("page2.aspx?var1="<value of variable such as textbox1.text or 56>)
 
Old July 9th, 2005, 01:26 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You need to construct the redirect string yourself... he was providing an example:

response.redirect("page2.aspx?var1=" & variableThatContainsMyValueForVar1)

-Peter
 
Old July 12th, 2005, 02:27 AM
Authorized User
 
Join Date: Feb 2005
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default

Oh...

   I am really very sorry to for got the &symbol.any way i hope you finished your work...

   -Ashok Parchuri
 
Old August 4th, 2005, 10:46 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks Ashok Parchuri and planoie..I have fix it...a late coming thanks...
 
Old August 17th, 2005, 12:53 AM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

why you are using response.redirectand all...to passing the values from one page to other pages..
because it doesnt provide security to our data right,..
what my suggestion is use the Context.Handler object.
simply you create object for that form in someother form and get the values.thats it.
if i am wrong pls corrcet me..?????

thanks
rams123






Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variables from 1 form to another. jainin_shah9 C# 10 February 18th, 2008 07:59 PM
passing unique record from form to form Baconant Beginning VB 6 1 January 2nd, 2008 06:20 PM
Passing FORM to FORM to PHP AV1611 PHP Databases 1 August 17th, 2005 03:32 PM
passing a variable from one form to another madhukp VB How-To 4 January 19th, 2005 12:45 AM
Passing Value from main form to Popup Form smartgir Access VBA 0 February 26th, 2004 06:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.