关于gridview的rowdatabind事件

来源:百度知道 编辑:UC知道 时间:2024/05/24 20:14:49
protected void GV_client_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=this.style.backgrondcolor;this.style.backgroundcolor=#33cccc");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundcolor=c;");
((LinkButton)e.Row.Cells[5].Controls[0]).Attributes.Add("onclick", "return confrim('确定删除吗?');");
}
}
这段代码在程序里没有相应是怎么回事啊,其他的功能都能正常实现
我是菜鸟 请教高手

是没有运行这里吗?
看看页面代码里gridview有这个方法没RowDataBound

断点if (e.Row.RowType == DataControlRowType.DataRow)
看是不是判断问题

在if (e.Row.RowType == DataControlRowType.DataRow)和e.Row.Attributes.Add("onmouseover", "c=this.style.backgrondcolor;this.style.backgroundcolor=#33cccc");
前分别设置断点 看程序到底运行到什么地方 如果在if之后就没运行了的话有可能是gridview里没有数据记录