datalist中嵌套gridview后 OnRowDataBound 事件无效,以下代码变的没有作用。protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#cccccc';d=this.style.color;this.style.color='#009999'");//backgroundColor='#95B8FF'#aca899
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;this.style.color=d");
Label myLabel = (Label)e.Row.Cells[2].FindControl("myLabel");
myLabel.Text = Convert.ToString(e.Row.RowIndex + 1);
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#cccccc';d=this.style.color;this.style.color='#009999'");//backgroundColor='#95B8FF'#aca899
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;this.style.color=d");
Label myLabel = (Label)e.Row.Cells[2].FindControl("myLabel");
myLabel.Text = Convert.ToString(e.Row.RowIndex + 1);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货