I'm working with another developer to satisfy their busienss requirement of enabling/disabling editing on a row-by-row basis based on a given criteria... For simplicity sake, let's say they can edit Even row #'s and Odd row #'s are displayed but not editable...
Our grid has a standard GridEditCommandColumn named "EditCommandColumn"... We also have an additional GridButtonColumn named "DeleteCommand" and its CommandName is set to "Delete"... There is also a ClientEvents setting for OnRowDblClick to call a JavaScript function which performs the following:
What I've done thus far is to use the following code to access the ImageButton in the GridEditCommandColumn and set it's Visible property to False... Same basic approach I'm assuming I would apply for the Delete column though I haven't made it that far yet...
So this works to hide the button and prevent the user from clicking on it, but it leaves the client-side OnRowDblClick still functional...
I was hoping to find something far more elegant / canned & ready-to-use... ie. a row-level setting of some sort - such as a property on the GridDataItem for "AllowEdit" or something similar... perhaps both "AllowEdit" and "AllowDelete"... but I see nothing of the sort...
What is the "right" way to handle this case? Or am I heading in the right direction and just need a few more tweaks....
I'm thinking my option here for dealing with the client-side double-click handler would be to do as described above and additionally catch the ItemCommand event and test for the same conditions and conditionally Cancel the ItemCommand event?
Our grid has a standard GridEditCommandColumn named "EditCommandColumn"... We also have an additional GridButtonColumn named "DeleteCommand" and its CommandName is set to "Delete"... There is also a ClientEvents setting for OnRowDblClick to call a JavaScript function which performs the following:
radGrid.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical()); |
What I've done thus far is to use the following code to access the ImageButton in the GridEditCommandColumn and set it's Visible property to False... Same basic approach I'm assuming I would apply for the Delete column though I haven't made it that far yet...
TableCell tableCell = gridDataItem["EditCommandColumn"]; |
| ImageButton imageButton = tableCell.Controls[0] as ImageButton; |
| imageButton.Visible = false; |
So this works to hide the button and prevent the user from clicking on it, but it leaves the client-side OnRowDblClick still functional...
I was hoping to find something far more elegant / canned & ready-to-use... ie. a row-level setting of some sort - such as a property on the GridDataItem for "AllowEdit" or something similar... perhaps both "AllowEdit" and "AllowDelete"... but I see nothing of the sort...
What is the "right" way to handle this case? Or am I heading in the right direction and just need a few more tweaks....
I'm thinking my option here for dealing with the client-side double-click handler would be to do as described above and additionally catch the ItemCommand event and test for the same conditions and conditionally Cancel the ItemCommand event?