2017-06-20 72 views
0

如何啓用/禁用OBOUT網添加,編輯,使用C#或jQuery的想法啓用/禁用添加,編輯,刪除大氣網格圖像按鈕?

我想這代碼刪除圖像圖標:

grdadmin.AllowAddingRecords = false; 

protected void Grid1_RowDataBound(object sender, GridRowEventArgs e) 
    { 
     GridDataControlFieldCell cell = e.Row.Cells[10] as GridDataControlFieldCell; 
     Control linksContainer = cell.Controls[0].Controls[0]; 

     bool disableEdit = false; 
     bool disableDelete = false; 
     disableEdit = true; 
     disableDelete = true; 
     linksContainer.Controls[0].Visible = !disableEdit; 
     linksContainer.Controls[2].Visible = !disableDelete; 
     linksContainer.Controls[1].Visible = !disableEdit && !disableDelete; 
    } 

,但我無法禁止的圖標

回答

0
rdadmin.AllowAddingRecords = false; 

protected void Grid1_RowDataBound(object sender, GridRowEventArgs e) 
{ 
    GridDataControlFieldCell cell = e.Row.Cells[10] as GridDataControlFieldCell; 
    Control linksContainer = cell.Controls[0].Controls[0]; 

    bool disableEdit = false; 
    bool disableDelete = false; 
    disableEdit = true; 
    disableDelete = true; 
    linksContainer.Controls[0].Enabled = !disableEdit; 
    linksContainer.Controls[2].Enabled = !disableDelete; 
    linksContainer.Controls[1].Enabled = !disableEdit && !disableDelete; 
} 

您必須使用Enabled進行設置。

相關問題