2
Reply

passing data from a page to another

Heaven Valenzona

Heaven Valenzona

May 21 2010 2:24 AM
4.8k
hello. I've created a page that has a gridview that when you selected a row on it, the data will pass into another page.. the code is this:

1stpage.aspx
 .......
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                    CellPadding="4" DataKeyNames="JO_No" DataSourceID="SqlDataSource2" 
                    ForeColor="#333333" GridLines="None" 
                    style="text-align: center; margin-top: 19px">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:HyperLinkField DataNavigateUrlFields="JO_No,JO_Type,JO_Desc,Customer_Username" 
                            DataNavigateUrlFormatString="SE_Diagnostic Form.aspx?no={0}&amp;type={1}&amp;desc={2}&amp;username={3}" 
                            Text="ACCEPT" />
                        <asp:BoundField DataField="JO_DateRequest" HeaderText="JO_DateRequest" 
                            SortExpression="JO_DateRequest" />
                        <asp:BoundField DataField="JO_Type" HeaderText="JO_Type" 
                            SortExpression="JO_Type" />
                        <asp:BoundField DataField="JO_Desc" HeaderText="JO_Desc" 
                            SortExpression="JO_Desc" />
                        <asp:BoundField DataField="Customer_Username" HeaderText="Customer_Username" 
                            SortExpression="Customer_Username" />
                        <asp:BoundField DataField="JO_No" HeaderText="JO_No" InsertVisible="False" 
                            ReadOnly="True" SortExpression="JO_No" Visible="False" />
                    </Columns>
..........

 2ndPage.aspx.cs
..........
  
    protected void Page_Load(object sender, EventArgs e)
    {
        string strNo = Request.QueryString["no"];
        string strDesc = Request.QueryString["desc"];
        string strType = Request.QueryString["type"];
        string strUsername = Request.QueryString["username"];

        Label2.Text = strNo;
        Label3.Text = strDesc;
        Label9.Text = strType;
        Label10.Text = strUsername;
}
...........


the passing of data from the gridview into the page of 2nd page worked!

but, I wanted to pass also the data from 2nd page that has been passed from 1st page.
here's my other part of the code in 2ndpage.aspx.cs

 ........
  protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("SE_TimeDtLs.aspx?strDesc=" + Server.UrlEncode(Label3.Text) + "&strNo=" + Label2.Text + "&strType=" + Label9.Text + "&strUsername=" + Label10.Text);

      
    }
.......

SE_TimeDtLs is my 3rd page. There's no output from it..
Where did I go wrong? please help.
thank you so much.

*asp.net
*c#
*web based

Answers (2)