我想这样,单击Gridview中某行的时候,如果第3列中有Yes,就可以编辑,否则不允许编辑,按钮为灰色。
解决方案 »
- 这样处理能达到每个用户共用数据么?
- asp.net 中怎么判断客户端的文件是否存在?
- 我现在想做一个关于各国国旗的页面,请问用repeater,datalist,datagrid好, 我现在没有思路,请帮帮忙!
- 麻烦高手帮帮忙!
- 立即结帐!!用户注稍功能是如何实现的??
- 一个可能简单的水晶报表问题多谢先
- 如何在服务器端给客户端的DataList中的CheckBox动态赋值?
- 高手请进---gridview控件中添加dropdownlist控件出现错误!
- 模式窗口打开问题
- 代码是全部写在.aspx中,还是写在.aspx和.aspx.cs中?
- 高分求asp连接SQL Server 2000数据库的完整例子,最好是自己写的
- 怎样做下拉菜单?
//最初默认为detailsview1.Enabled=false; protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text.Equals("Yes"))
{
//detailview1是你的DetailsView的名称 DetailsView dv = e.Row.FindControl("detailsview1") as DetailsView;
dv.Enabled = true;
}
}
}
但是这个编辑按钮在GridView1_SelectedIndexChanging下面用Findcontrol,居然找不到
{
if (GridView1.Rows[e.NewSelectedIndex].Cells[2].Text.Equals("Yes"))
{
DetailsView dv = GridView1.Rows[e.NewSelectedIndex].FindControl("detailsview1") as DetailsView;
dv.Enabled = true; }
}
{
string Identity= GridView1.Rows[GridView1.SelectedIndex].Cells[2].Text;
此处获取是否第3列是yes
DetailsView1.DataSource = myDb.dt(sqlStr);
DetailsView1.DataBind();
if(Identity!="yes")
{
DetailsView1.Enabled=false ;
}
}