DataGrid行随鼠标移动变色及单击双击行事件处理
2013-01-24 17:23
337 查看
protected void Dgd_course_ItemDataBound(object sender, DataGridItemEventArgs e)
{
// 鼠标移动行变色
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#439be6'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
// 某行获取其中的某个字段的数值
for (int i = 0; i < e.Item.Cells.Count; i++)
{
e.Item.Cells[i].Attributes.Add("onclick", "alert('" + e.Item.Cells[2].Text + "');"); // 单击获取
// e.Item.Cells[i].Attributes.Add("ondblclick", "alert('" + e.Item.Cells[2].Text + "');");//双击获取
// e.Item.Attributes.Add("onclick", "window.open('WebForm2.aspx?ZoneNo=" + e.Item.Cells[1].Text + "')");
}
// 鼠标移动行变色
if (e.Item.ItemIndex >= 0)
{
e.Item.Attributes["onmouseover"]="this.name=this.style.backgroundColor;this.style.backgroundColor='#CCCCFF';";
e.Item.Attributes["onmouseout"]="this.style.backgroundColor=this.name;";
}
}
http://book.4ucode.com/Study/Topic/1005313
{
// 鼠标移动行变色
e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#439be6'");
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
// 某行获取其中的某个字段的数值
for (int i = 0; i < e.Item.Cells.Count; i++)
{
e.Item.Cells[i].Attributes.Add("onclick", "alert('" + e.Item.Cells[2].Text + "');"); // 单击获取
// e.Item.Cells[i].Attributes.Add("ondblclick", "alert('" + e.Item.Cells[2].Text + "');");//双击获取
// e.Item.Attributes.Add("onclick", "window.open('WebForm2.aspx?ZoneNo=" + e.Item.Cells[1].Text + "')");
}
// 鼠标移动行变色
if (e.Item.ItemIndex >= 0)
{
e.Item.Attributes["onmouseover"]="this.name=this.style.backgroundColor;this.style.backgroundColor='#CCCCFF';";
e.Item.Attributes["onmouseout"]="this.style.backgroundColor=this.name;";
}
}
http://book.4ucode.com/Study/Topic/1005313
相关文章推荐
- DataGrid行随鼠标移动变色及单击双击行事件处理
- 鼠标单击和双击中的事件处理
- Flash AS3 显示对象对鼠标单击,双击,拖拽事件的处理
- 分享[ASP.NET]GridView鼠标停留变色和单击处理事件
- ASP.NET GridView鼠标停留变色,行单击显示详细记录的事件处理
- Flash AS3 显示对象对鼠标单击,双击,拖拽事件的处理
- GridView鼠标停留变色和客户端单击处理事件
- unity3d 学习笔记___虚拟轴、鼠标事件、双击事件的应用处理
- Android 鼠标事件 (单击,双击,滑动)
- java小程序中鼠标事件的响应处理(包含右键、双击等)
- [AS][转]AS3 中单击、双击事件处理
- CListCtrl控件主要事件及LVN_ITEMCHANGED消息和鼠标双击列表项事件的处理
- gridview鼠标双击事件(跳转至新页面并传值)单击获取值
- DataGrid:鼠标移动行变色、单击行弹出提示窗体
- jquery 区分鼠标单击双击事件插件
- 鼠标单击和双击处理
- 单击和双击事件的冲突处理示例代码
- WPF 鼠标移动到图片变大,移开还原,单击触发事件效果
- GridView 单击选择行,双击打开详细页面,鼠标移到某行上变色