簡體   English   中英

如何在單元級別而不是整列上設置禁用單元格

[英]How to set disable cell on cell level instead of whole column

根據列級解決方案: https//stackoverflow.com/a/11803015/1460189

private void dg_CellListSelect(object sender, CellEventArgs e)
    {
        if (e.Cell.Column.Key == "someID")
            e.Cell.Row.Cells["someColumn"].Activation = Activation.NoEdit;
        //Property or indexer cannot be assigned to -- it is read only
    }

基於特定單元格上的某些邏輯,我想禁用它,但顯然無法設置屬性Activation的值?

如果禁用,則表示不允許用戶編輯單元格,那么我認為您需要ReadOnly屬性。

e.Cell.Row.Cells["someColumn"].ReadOnly = false;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM