This question is locked. New answers and comments are not allowed.
Hello all,
I have a grid with a delete command column. I would like to have that button be present for some but not all rows, or at least disabled.
I think the way to go about this is to use a cell action to set up my conditional but it isn't obvious to me how best to disable the button or hide it.
1. Is checking for cell.Column.Title == null the best way to determine that I am in the Command column?
2. I believe that setting HtmlAttributes on the cell impacts the TD item that wraps the button so I am not sure how that will help me. Am I missing something? It seems like it should be easy and it's just late and I'm tired.
Thanks!
I have a grid with a delete command column. I would like to have that button be present for some but not all rows, or at least disabled.
I think the way to go about this is to use a cell action to set up my conditional but it isn't obvious to me how best to disable the button or hide it.
1. Is checking for cell.Column.Title == null the best way to determine that I am in the Command column?
2. I believe that setting HtmlAttributes on the cell impacts the TD item that wraps the button so I am not sure how that will help me. Am I missing something? It seems like it should be easy and it's just late and I'm tired.
Thanks!
.Columns(columns => { columns.Bound(p => p.Name).Width(150).Title("Name");
columns.Bound(p => p.Owner).Width(100).Title("Owner").ReadOnly(); columns.Command(c => { c.Delete().ButtonType(GridButtonType.Image); //can we disable these for non owner? }).Width(100); }).CellAction( cell => { //null Title -> command column if (cell.Column.Title == null && !CurrentOwner.Equals(cell.DataItem.Owner)) {
//Do something to disable the button } } )