[英]How to pass value of GridView from one page to another in asp.net c#?
如何将网格视图的值从一个页面传递到另一个页面? 这是我的代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.Header)
{
// // e.Row.Cells[0].Text = "<a href=" + "javascript:window.open('http://www.google.com')" + " >" + e.Row.Cells[0].Text + "</a>";
e.Row.Cells[0].Text = "<a id=\"linkres\" CssClass=\"dgrid\" runat =\"server\" href= \"javascript:window.open('Preview.aspx'),_self\" >" + e.Row.Cells[0].Text + "</a>";
}
}
我需要在GridView上传递所选项的值,然后检索到另一个页面。
每当您需要访问多个页面上的某些数据时,您有以下选择:
对于你正在做的事情,我通常会选择第一个。
Session["GridViewValue"] = e.Row.Cells[0].Text;
在另一页上
string something = Session["GridViewValue"].ToString();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.