我要根据表中的一个字段来判断修改项目,写了下面的代码,怎么不行啊?哪位给我纠正1下,谢谢
protected void gvData_RowEditing(object sender, GridViewEditEventArgs e)
    {        if (Convert.ToInt32(this.gvData.Rows[e.NewEditIndex].Cells[2].Text) == 3)
        {
            this.gvData.Rows[e.NewEditIndex].Cells[5].Attributes["ReadOnly"] = "True";        
}
        else
        {
            this.gvData.Rows[e.NewEditIndex].Cells[5].Attributes["ReadOnly"] = "False";       
 }
    }

解决方案 »

  1.   

    没有效果,估计这句写错了
    this.gvData.Rows[e.NewEditIndex].Cells[5].Attributes["ReadOnly"]   =   "True";  
    但是不知道该怎么写。
      

  2.   

    this.gvData.Rows[e.NewEditIndex].Cells[5].Enabled       =       True; 
    就可以实现不能修改的目的吧?
      

  3.   

    to yuexiaxiaochongzi这样子不可以的,我刚刚试了。