protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if( e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标移动到每项时颜色交替效果
//鼠标移动到每项时颜色交替效果
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#E2F2FF'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
//单击/双击 事件
e.Row.Attributes.Add("OnDblClick", "DbClickEvent('" + e.Row.Cells[1].Text + "')");
e.Row.Attributes.Add("OnClick", "ClickEvent('" + e.Row.Cells[1].Text + "')");
e.Row.Attributes.Add("OnKeyDown", "GridViewItemKeyDownEvent('" + e.Row.Cells[1].Text + "')");
//设置悬浮鼠标指针形状为"小手"
e.Row.Attributes["style"] = "Cursor:hand";
}
}
源于网络...
gridview 双击单击事件
最新推荐文章于 2016-04-07 14:32:07 发布