//在綁定時給行添加事件
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#在綁定時給行添加事件
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.