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";
}
}
转载于:https://www.cnblogs.com/gaoxuzhao/archive/2011/10/13/2209858.html