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 双击单击事件
最新推荐文章于 2024-10-18 14:16:09 发布
这篇博客介绍了如何在GridView控件中实现行的双击和单击事件处理,包括鼠标移入移出时的颜色变化,以及设置鼠标指针为小手形状,通过OnDblClick和OnClick事件绑定特定的函数调用。

2129

被折叠的 条评论
为什么被折叠?



