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.

 
 
 
 
 
4.8 Star
(32)
64,622 times
Add to favorites
1/18/2012
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • how to pass values between web forms?
    2 Posts | Last post August 13, 2013
    • there are 4 text boxes in one web form. how to pass values entered in those textboxes to other web form by using query string method.
      please help .i have searched everywhere on the internet.
      thanks in advance
    • In the document I provided a link to, the first section is "To use a query string to pass information".  Follow those instructions, using a different field name for each text box.
  • i like the sample "How to pass data between asp.net pages". my query is what if there are 4 text boxes and to view data in other web page of all the text boxes...what will be the code?
    2 Posts | Last post August 12, 2013
    • My question is : I am using 4 text boxes in one web form. when button is click all the data in the text boxes should pass to other web form as a text.
    • I don't understand what you mean by "as a text", but you might find helpful information in the MSDN document that goes with this sample:  http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
      
  • Http post doesn't work in IE9?
    3 Posts | Last post September 24, 2012
    • Nothing happens when I press the "Use HttpPost" button in IE9 but it works well in firefox 13. 
      
      I checked the source code of both of the two browsers, then I found that IE9 missed the javascript postback functions, why? Is this a bug of IE9?
      
    • IE9 works fine with "Use HttpPost" for me.  Could your IE9 have JavaScript disabled? If that's not it, you might try opening a thread at forums.asp.net or stackoverflow.com, as the problem appears to be in IE9 configuration rather than the sample code.
    • thanks Tom.
  • what is the use of setting DataToSend
    2 Posts | Last post May 02, 2012
    •  public string DataToSend
              {
                  get
                  {
                      return DataToSendTextBox.Text;
                  }
              }
    • This illustrates the public properties method of passing data.  See PublicPropertiesPage.aspx where the data in the property is received.
  • How to pass data if using master page and contentpages
    3 Posts | Last post April 30, 2012
    • 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.
      
      
    • Server.Transfer() will works.