日期:2014-05-18 浏览次数:21079 次
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Attributes["onclick"] = String.Format("JavaScript:window.open({0})", "http://www.csdn.net"); }
------解决方案--------------------
同意楼上。
e.Row.Attributes["onclick"] = string.Format("window.open('{0}');", "http://www.csdn.net"); e.Row.Attributes["onmouseover"] = "this.style.backgroundColor='Maroon';this.style.color='White';this.style.cursor='hand';"; e.Row.Attributes["onmouseout"] = "this.style.backgroundColor='White';this.style.color='Black';"
------解决方案--------------------
另外最好是在
if(e.Row.RowType==DataControlRowType.DataRow)
{
//在这里为行添加css属性。
}
------解决方案--------------------
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Attributes["onclick"] = String.Format("JavaScript:location.href='http://www.csdn.net'); }
------解决方案--------------------
<asp:HyperLinkField DataNavigateUrlFields="detaineeId" DataNavigateUrlFormatString="../InAndOutCalaboose/InCalabooseShow.aspx?Id={0}"
Text="查 看"/>
加这句在gridview里面,哥子,思想太僵化了是卜行滴~~~,那个路径自己改哈
要不就得这样,好像也可以
protected void gdvComplice_RowDataBound(object sender, GridViewRowEventArgs e)
{
//如果是绑定数据行
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "window.location.href='InCalaboose.aspx?Id=" + this.gridInCalaBooseList.DataKeys[e.Row.RowIndex].Value + "'");
}
}