在GridView中添加事件RowDataBound,BXBH是GridView中一列,通过下面的方法就可以提取到所单击HyperLink所在行的编号。
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string bxbh = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "BXBH"));
HyperLink hl = (HyperLink)e.Row.FindControl("HyperLink1");
if (e.Row.RowType == DataControlRowType.DataRow)
{
hl.NavigateUrl = "~/details.aspx?height=350&width=300&modal=true&bxbh=" + bxbh.ToString();
}
}