想要做这样的功能,点击gridview中的任意行,链接到另外一页
我是这样写的
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string url,href; if (e.Row.RowType == DataControlRowType.DataRow)
{
这里怎么写?
e.Row.Attributes.Add("onclick", href); }
}
不知道中间那段怎么写,这个代码可以实现吗
我是这样写的
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string url,href; if (e.Row.RowType == DataControlRowType.DataRow)
{
这里怎么写?
e.Row.Attributes.Add("onclick", href); }
}
不知道中间那段怎么写,这个代码可以实现吗
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "window.location.href='webform3.aspx'");
}
}
我想连到 aa.aspx
如果你想连到 aa.aspx,并且需要根据每一行得到不同的查询字符串值,那么需要给gridview创建链接列HypeLinkField,在链接列中设置每一行的查询字符串值