Gridview将使用gridview将数据从行发送到viewcart.aspx

Gridview将使用gridview将数据从行发送到viewcart.aspx

问题描述:

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");


}
}

重定向到Viewcart.aspx之后,什么也没发生……


}
}

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

有很多方法可以将值从一页传递到另一页.检查Microsoft网站以获取更多详细信息:

详细信息 http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx [^ ]

我正在使用querystring
举一个简短的例子
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

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.



显然您有一些误解,我建议您看下面的示例并进行相应的操作,
http://csharpdotnetfreak.blogspot.com/2009/05/aspnet-creating- shopping-cart-example.html [ ^ ]
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[^]