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

ASP.NET行变色,及禁用编辑,删除按钮

2009-05-29 21:42 417 查看
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='#8AC8F3'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//编辑按钮禁用
LinkButton EditBt = (LinkButton)(e.Row.Cells[16].FindControl("LinkButton1"));
EditBt.Enabled = false;
//删除按钮禁用
LinkButton DeletBt = (LinkButton)(e.Row.Cells[16].FindControl("LinkButton2"));
DeletBt.Enabled = false;
}

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