您的位置:首页 > 其它

GridView中双击某一行时跳转到另外一个页面

2011-10-13 10:31 204 查看
GridView中可以这样写
protected void grvList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=style.backgroundColor;style.backgroundColor='#add8e6'");
e.Row.Attributes.Add("onmouseout", "style.backgroundColor=c");

//double click
string strId = grvList.DataKeys[e.Row.RowIndex].Value.ToString();
e.Row.Attributes.Add("ondblclick", "location.href='test.aspx?Id=" + strId + "'");
e.Row.Attributes["style"] = "Cursor:hand";
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐