2016-01-29 87 views
0

有没有办法允许编辑某一行而不是整行?ASP.NET GridView允许编辑某一行

当我搜索一个用户时,它会将数据填充到GridView中。如果将AutoGenerateEditButton设置为True,则所有行都是可编辑的。例如,如果GridView有10行,当行中的数据在使用If-else语句的特定条件之间时,我只希望底部5是可编辑的而不是整行10行。

回答

1

尝试绑定事件检查标准this..On GridView的行数据..

protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e) 
    { 
if ("Your Condition") 
     { 
      if ("your condition") 
      {     
       e.Row.Enabled = true;//row is editable 
      } 
      else 
      { 
       e.Row.Enabled = false;//row is not editable 
      } 
      } 
} 
+0

感谢的人。这个对我有用。 –