rahul patil

rahul patil

  • 1.8k
  • 109
  • 1.2k

how to display data one page to last(third page) in asp.net

May 9 2020 12:15 AM
I want to first page data display on last page
problem is first page data is not pass the last page give an error object referance not set to an object
 
PersonalDetail.aspx 1 page
     
  1.    <form id="form1" runat="server">  
  2.         <h1 style="text-align: center">Personal Information:</h1>  
  3.   
  4.         FirstName:<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>  
  5.         <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Enter Your Name" ControlToValidate="txtFirstName" ForeColor="Red"></asp:RequiredFieldValidator>  
  6.         <div style="margin-left: 5px"></div>  
  7.   
  8.         LastName:<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>  
  9.         <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Enter Your LastName" ControlToValidate="txtLastName" ForeColor="Red"></asp:RequiredFieldValidator>  
  10.         <div style="margin-left: 5px"></div>  
  11.   
  12.         Date Of Birth:<asp:Calendar ID="txtcalender" runat="server"></asp:Calendar>  
  13.   
  14.         <div style="text-align:center">  
  15.             <asp:Button ID="Button1" runat="server" Text="Next" OnClick="Button1_Click" />  
  16.         </div>  
  17.     </form>  
 PersonalDetail.aspx.cs
  1. protected void Button1_Click(object sender, EventArgs e)  
  2.  {  
  3.     Response.Redirect("ContactInformation.aspx?FirstName=&LastName=&DateofBirth=" + txtFirstName.Text +txtLastName.Text + txtcalender.SelectedDate);  
  4.  }  
 contactinformation.aspx 2 page
  1. <form id="form1" runat="server">  
  2.        <h1 style="text-align: center">Contact Information:</h1>  
  3.   
  4.        EmailId:<asp:TextBox ID="txtEmailid" runat="server"></asp:TextBox>  
  5.        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please Enter Your EmailId" ControlToValidate="txtEmailid" ForeColor="Red"></asp:RequiredFieldValidator>  
  6.        <div style="margin-left: 5px"></div>  
  7.   
  8.        MobileNo:<asp:TextBox ID="txtMno" runat="server"></asp:TextBox>  
  9.        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please Enter Your MobileNo" ControlToValidate="txtMno" ForeColor="Red"></asp:RequiredFieldValidator>  
  10.        <div style="margin-left: 5px"></div>  
  11.   
  12.        Password:<asp:TextBox ID="txtPass" runat="server" TextMode="Password" ></asp:TextBox>  
  13.        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please Enter Your Password" ControlToValidate="txtPass" ForeColor="Red"></asp:RequiredFieldValidator>  
  14.        <div style="margin-left: 5px"></div>  
  15.   
  16.        <div style="text-align:center">  
  17.        <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />  
  18.        </div>  
  19.    </form>  
 
 
contactinformation.aspx.cs
 
  1. protected void Page_Load(object sender, EventArgs e)  
  2. {  
  3.     string FirstName = Request.QueryString["FirstName"].ToString();  
  4.     string LastName = Request.QueryString["LastName"].ToString();  
  5.     string DateofBirth = Request.QueryString["DateofBirth"].ToString();  
  6.   
  7. }  
  8.   
  9. protected void Button1_Click(object sender, EventArgs e)  
  10. {  
  11.     Response.Redirect("DisplayPage.aspx?EmailId=&MobileNo=" +  txtEmailid.Text + txtMno.Text);  
  12.   
  13. }  
 DisplayPage.aspx.cs 3 Page
 
  1. protected void Page_Load(object sender, EventArgs e)  
  2. {  
  3.     string FirstName = Request.QueryString["FirstName"].ToString();  here give the error object referance not set to an object  
  4.     string LastName = Request.QueryString["LastName"].ToString();    here give the error object referance not set to an object  
  5.     string DateofBirth = Request.QueryString["DateofBirth"].ToString(); here give the error object referance not set to an object  
  6.       
  7.     string EmailId = Request.QueryString["EmailId"].ToString();  
  8.     string MobileNo = Request.QueryString["MobileNo"].ToString();  
  9.   
  10.     Response.Write(FirstName);  
  11.     Response.Write(LastName);  
  12.     Response.Write(DateofBirth);  
  13.   
  14.   
  15.     Response.Write(EmailId);  
  16.     Response.Write(MobileNo);  
  17. }  
 display the personal information data and contact information data display on the last page(DisplayPage.aspx.cs)
 
   
 

Brought to you by:

Answers (20)