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;
}
}
{
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;
}
}
相关文章推荐
- 关于ASP.NET中GridView控件中编辑和删除按钮布局问题
- ASP.NET DataList添加删除按钮
- asp.net中用LinkButton控制后台代码使其可以进行编辑,预览,删除功能
- FckEditor添加右键菜单;增加编辑区右键图片删除功能(asp.net )
- asp.net防止刷新时重复提交(可禁用工具条刷新按钮)
- asp.net c# 对GridView编辑,删除,更新,取消的操作
- ASP.NET 2.0数据教程之三十六 在DataList里编辑和删除数据
- asp.net coolite 删除时弹出确定按钮
- ASP.NET中ListView的插入、删除、编辑、读取
- asp.net2.GridView选中,编辑,取消,删除
- asp.net下按钮点击后禁用的实现代码
- ASP.NET GridView用法(二) 模板,脚注,排序,编辑,删除,多选,分页,添加
- js禁用后退键和禁用后退按钮 ASP.net
- asp.net禁用按钮以防止重复提交 转
- ASP.NET - Repeater控件删除按钮,点击删除信息
- 在ASP.NET 2.0中操作数据之三十六:在DataList里编辑和删除数据概述
- [Asp.net MVC]Asp.net MVC5系列——实现编辑、删除与明细信息视图
- ASP.NET(C#) GridView (编辑、删除、更新、取消)
- asp.net 在gridview中删除和编辑操作
- 关于ASP.NET中GridView控件的编辑和删除问题!