Microsoft Developer Network > Samples >
How to Pass Data Between ASP.NET Pages

How to Pass Data Between ASP.NET Pages

A Visual Studio Project which demonstrates several ways to pass data from one ASP.NET Web Forms page to another one.


Select a language
 
 
 
 
 
(13)
8,452 times
1/18/2012
E-mail Twitter del.icio.us Digg Facebook
Add To Favorites
Description
Browse Code
Q and A (1)
Sign in to Ask a Question


  • How to pass data if using master page and contentpages
    2 Posts | Last Post May 23, 2011
    • Hi, How do you pass the querystring if you are using master pages and content pages for example, i have a master page and two content pages, the first page which is a contentpage sends a response.redirect to the second content page, using your example doesn't show the query string on the master pages url?.
    • When passing data from one content page to another content page,  master page is not in scene. Secondly when we use Response.Redirect() method, we need to pass the query string like
      string url="Second.aspx?fieldname1=data1&fieldname2=data2
      Response.Redirect(ur);
      
      We can also use Server.Tranfer() method instead of redirecting like this. It automatically passes the data in current content page to next content page. We can use Hidden Fields/Cookies/Session variables to hold data in second page and use for processing further.