C#在绑定时给行添加事件
2009-09-21 14:15
113 查看
//在绑定时给行添加事件
protected void gvOrderQuery_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#99aa00';this.style.color='buttontext';this.style.cursor='default'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';this.style.cursor=''");
e.Row.Attributes.Add("onclick", "this.style.backgroundColor='red';this.style.color='buttontext';this.style.cursor='default'");
e.Row.Attributes.Add("onclick", "location.href='MainLineOrderQuery.aspx?title="+e.Row.Cells[1].Text+"'");
}
}
protected void gvOrderQuery_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#99aa00';this.style.color='buttontext';this.style.cursor='default'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';this.style.cursor=''");
e.Row.Attributes.Add("onclick", "this.style.backgroundColor='red';this.style.color='buttontext';this.style.cursor='default'");
e.Row.Attributes.Add("onclick", "location.href='MainLineOrderQuery.aspx?title="+e.Row.Cells[1].Text+"'");
}
}
相关文章推荐
- C#中控件动态添加事件绑定的时机详解
- asp.net C#动态添加创建生成button按钮控件没有触发执行响应click绑定事件处理
- C# datagridview 中添加下拉框,并绑定selectedindexchanged事件
- C#为控件动态添加事件绑定的时机
- C#winform中动态添加button并绑定事件
- 动态添加ASP.NET控件并绑定处理事件一例
- 为元素添加class ,无法绑定事件 ? jie
- jQuery给动态添加的元素绑定事件
- JavaScript实现跨浏览器的添加及删除事件绑定函数实例
- jQuery给动态添加的元素绑定事件
- Repeater控件三层嵌套-内层Repeater添加绑定事件
- c#.NET考证中添加数值改变事件
- Knockout: 实践CSS绑定和afterkeydown事件, 给未通过校验的输入框添加红色边框突出显示; 使用afterkeydown事件自动将输入转大写字母.
- Knockout: 使用CSS绑定和event的blur失去焦点事件, 给未通过校验的输入框添加红色边框突出显示.
- 【转载于<小锋刚>博客园】C#遍历ContextMenuStrip右键菜单中包含子菜单的所有菜单并添加事件
- C#_动态生成控件以及添加事件处理
- jQuery-为动态添加的元素绑定事件
- C# ComboBox(DropDownList)数据绑定再添加一项
- 利用反射绑定事件处理程序(C#)