//在绑定时给行添加事件
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#在绑定时给行添加事件
最新推荐文章于 2024-10-13 12:55:03 发布