Click here to Skip to main content
15,921,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if(e.CommandName == "Select")
            {
                int index = Convert.ToInt32(e.CommandArgument);
                string id = GridView2.Rows[index].Cells[0].ToString();
                string name = GridView2.Rows[index].Cells[1].ToString();
                string price = GridView2.Rows[index].Cells[2].ToString();
                Response.Redirect("ViewCart.aspx");

}
}

after the redirect to Viewcart.aspx Nothing happens its just empty...
Posted

There are many ways to pass values from one page to another. Check the microsoft site for more details:

More Information http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx[^]

I am giving a short example using querystring

C#
Response.Redirect("ViewCart.aspx?index ="index"&ID="id);

//Within the code for page load event of ViewCart.aspx

protected void Page_Load(object sender, EventArgs e)
{
String index = Request.QueryString["index"];
String id =Request.QueryString["id"];


}


Note : Never pass sensitive data using querystring.
 
Share this answer
 
v2
Hi,
clearly you have some misconception, I suggest you to see the example below and do accordingly,
http://csharpdotnetfreak.blogspot.com/2009/05/aspnet-creating-shopping-cart-example.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900