Thanks for the response Princy, but unfortunately my situation is a bit different...
My situation is similar to the following post:
and the solution suggested by the telerik team in this post works fine as long as the grid does not have any detail tables.
In my case, I have a few grids that have detail tables. What I am seeing in this case is a weird behavior in my "HideAddNewCommandButton
" function from the code pasted in the original post.
When this function is called on the MasterTableView, the "radGridTableView.GetItems(GridItemType.CommandItem)
" returns the command item and I can process it and hide the buttons.
When this function is called on the DetailTableView the "radGridTableView.GetItems(GridItemType.CommandItem).Length
" is ZERO, i.e it has no command items and therefore does not find the buttons I want to hide.
I confirmed it was the right detail table by looking at the "radGridTableView.Name
" property, and also confirmed that the markup has the CommandItemDisplay property set so that it is visible, I mean the command bar and the button is visible on the grid !!. Yet for some reason, the code cannot find the command item in the detail tables!
Any idea why this might be happening or how I can get to the command items of detail tables in the Pre-Render?
(radGridTableView.GetItems(GridItemType.CommandItem).Length <= 0)
var commandItem = radGridTableView.GetItems(GridItemType.CommandItem);
var newRecordButton = commandItem.FindControl(
) newRecordButton.Visible =
var initInsertButton = commandItem.FindControl(
) initInsertButton.Visible =