下面是這是寫在我們所希望的頁面的代碼..如何在GridView控件發送選定行的值設置到下頁..,
protected void Page_Load(object sender, EventArgs e)
{
if (this.Page.PreviousPage != null)
{
int rowIndex = int.Parse(Request.QueryString["RowIndex"]);
GridView GridView1 = (GridView)this.Page.PreviousPage.FindControl("gv1");
GridViewRow row;
row = GridView1.Rows[rowIndex];
lblid.Text = row.Cells[1].Text;
lblname.Text = (row.FindControl("lblName") as Label).Text;
lblmt.Text = row.Cells[3].Text;
lblyer.Text = row.Cells[4].Text;
}
}
的可能重複(http://stackoverflow.com/questions/ [如何在整個會議的ASP.net insted的頁面傳遞值] 14956027 /如何傳遞值 - 跨頁面在asp-net-ins-of-session) – fubo
把你通過它來代碼的代碼。理想情況下,你應該從gridview本身發送值。 –