How to disable a control in command field control in gridview

后端 未结 5 493
刺人心
刺人心 2021-01-07 09:07

how to find a command field control in the gridview.

in a method not in the row data bound.

so far i have used this coding but i cant find the control.

5条回答
  •  天命终不由人
    2021-01-07 09:53

    Cast it as a DataControlFieldCell and then set Enabled to false.

    Where: row.Controls[0] is your CommandField control

    foreach (GridViewRow row in ManageDNXGridView.Rows)
    {
        DataControlFieldCell editable = (DataControlFieldCell)row.Controls[0];
        editable.Enabled = false; 
    }
    

提交回复
热议问题