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 2005

Tip: Looking for answers? Try searching our database.

passing variables question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
melinda - 20 Jul 2005 20:05 GMT
Ok, sorry if this is dumb ?, but I'm extremely new to ASP.net.   I've used
PHP and am now trying to figure out the best way (or any way) to do this in
ASP.net:
I have a page where the user enters data and clicks a submit button which
redirects to another page.  This 2nd page can retrieve all of the POST
variables submitted from the previous page.   How is this done in ASP.net?    
Thanks!
Marina - 20 Jul 2005 20:09 GMT
The ASP.NET model is for the first page to handle its own data submission.
It should deal with the data, and then redirect to the next page. That page
then handles all its own data.

If you did want to do what you are describing, you would either need to set
the form to post to the second page to begin with, or you would need to do a
Server.Transfer to the second page.

> Ok, sorry if this is dumb ?, but I'm extremely new to ASP.net.   I've used
> PHP and am now trying to figure out the best way (or any way) to do this
[quoted text clipped - 4 lines]
> variables submitted from the previous page.   How is this done in ASP.net?
> Thanks!
Shahid Juma - 20 Jul 2005 20:12 GMT
You can save the values to a a session and redirect the page to the
second page and then read from the session.

Also, this might help:

http://authors.aspalliance.com/kenc/passval.aspx

Shahid
John - 20 Jul 2005 20:15 GMT
> Ok, sorry if this is dumb ?, but I'm extremely new to ASP.net.   I've used
> PHP and am now trying to figure out the best way (or any way) to do this
[quoted text clipped - 4 lines]
> variables submitted from the previous page.   How is this done in ASP.net?
> Thanks!

ASP.NET forms by default submit to self.

I generally put my code in the button click server event.  Then I redirect
to the next page if all goes well.

John
Irfan Afzal - 26 Jul 2005 07:53 GMT
There are different technique to transfer data from one page to another. The
simple and easy way is to use Session Variable. You can also use QueryString.
For Session variable, You can save the values to a session and redirect the
destination page and then read the date from the session.

let there are two pages WebForm1.aspx and WebForm2.aspx. on the WebForm1 you
have 2 string variables and u want to access these two variables on 2nd page

U have to do on the Webform1.aspx:

string name = "Irfan";
string age =  30;

Session["anySessionVariableName1"] = name;
Session["anySessionVariableName2"] = age;

Response.Redirect("WebForm2.aspx");

on the WebForm2.aspx, u have to do for retrieving the name and age:

string nm = Session["anySessionVariableName1"].ToString();
string ag = Session["anySessionVariableName2"].ToString();

> Ok, sorry if this is dumb ?, but I'm extremely new to ASP.net.   I've used
> PHP and am now trying to figure out the best way (or any way) to do this in
[quoted text clipped - 3 lines]
> variables submitted from the previous page.   How is this done in ASP.net?    
>  Thanks!

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.