我有一个从数据集填充的网格视图,当用户单击 gridview 标题时,我必须重定向另一个页面。如何获取用户单击的 gridview 标题文本。我在这里尝试了一些代码...
protected void gv2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Attributes.Add("onclick", "location='/SampleProgram/AnotherPage.aspx?empid=" + e.Row .Cells[0].Text+ "'");//this will give me first column header's text.
}
}
非常感谢您的帮助和兴趣...