Passing data to next page RRS feed

  • Question

  • hi,

    I've created two pages (page1 & page2) in page1 there are some textboxes . after filling all of them user should click on a button to go to next page so that the text of one of those textboxes will be shown in the label which is provided in page2.

    in page 2 I've written <%@ PreviousPageType VirtualPath="~/Default.aspx" %> in page2.aspx
    then  Label1.Text = PreviousPage.customer; in page2.aspx.cs

    and in page1.aspx.cs

    public string customer
                  return textbox1.Text;

    but I faced this error >>  Object reference not set to an instance of an object. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Help me plzz
    Wednesday, February 25, 2009 6:04 PM