您的位置:首页 > 编程语言 > C#

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+"'");

}

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