5 Answers, 1 is accepted
I guess you want to hide the button placed in CommandItemTemplate if any of the value in column is null. If so you can try the following code snippet in order to achieve this.
Dim commandItem As GridCommandItem = DirectCast(RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)(0), GridCommandItem)
I Do in fact want a button hid but I misspoke in my first post, I want to check the field for not null. I'm going to post more code to make sure I am clear as to what is going on. I'm sure this is simple but I am new to Telerik so thanks for the help.
Here is the column I want to check during load and if there is a date in the field (indicating the Job is closed), I want to hide the button in the CommandItemTemplate button "btnCloseRwp" that is used to close Jobs.
Here is the CommandItemTemplate:
You can also wire the ItemDataBound event and set the visibility of the button in the following way:
As to the exception you get - could you verify whether you have set the MasterTableView.CommandItemDisplay property to value different than "none"?
the Telerik team
I have a similar need and have not been able to create a solution that is to my satisfaction.
I want to change the commanditemtemplate content based on status and number of rows in the grid.
No rows : Only insert command button should be visible, all others invisible.
Rows exist: Update not visible
On insert : Only cancel and save visible
On edit: Delete, Insert, Refresh invisible
I think you get my drift.
I have a working solution but it involves setting visibility for commanditems in itemdatabound event when binding GriddataItem.
I actually would like to set visibility in declaration as in the following snip:
Here are snips from databound :
Any input on how to improve on this?
For instance I would need to have number of rows in aspx to get this to work.
Please try the following approach:
I hope this helps.