您的位置:首页 > 其它

GridView行 添加鼠标双击事件

2013-08-18 09:08 288 查看
protected void gvUseOperateLogs_RowDataBound(object sender, GridViewRowEventArgs e)

{

if (e.Row.RowType == DataControlRowType.Header)

{

e.Row.CssClass = "Grid_AlternatingItem";

}

if (e.Row.RowType == DataControlRowType.DataRow)

{

e.Row.Attributes["onmouseover"] =

"this.style.cursor='hand';this.style.textDecoration='underline';";

e.Row.Attributes["onmouseout"] =

"this.style.textDecoration='none';";

e.Row.Attributes.Add("id", "gvResult_row_" + e.Row.RowIndex);

//

//給gridview添加行雙擊事件

e.Row.Attributes["ondblclick"] = string.Format("window.location.href='UseOperateLog_Detail.aspx?IDSeqNo={0}'",((Label)e.Row.FindControl("lblIDSeqNo")).Text);

//根據單雙號進行樣式設定

//if (e.Row.RowIndex % 2 != 0)

//{

//    e.Row.CssClass = "Grid_AlternatingItem";

//    //設定選中的樣式

//    e.Row.Attributes["onclick"] = "SeletedRow('gvResult_row_" + e.Row.RowIndex + "','Grid_AlternatingItem'," + e.Row.RowIndex + ");";

//}

//else

//{

e.Row.CssClass = "Grid_OddItem";

//設定選中的樣式

e.Row.Attributes["onclick"] = "SeletedRow('gvResult_row_" + e.Row.RowIndex + "','Grid_OddItem'," + e.Row.RowIndex + ");";

//}

}

}
1.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: