When a parent record is expanded I want to evaluate and either show or hide the AddNewRecordButton on the multiple detail tables . I found that I can turn it off in the ItemDataBound event with this code. Which appears to work until the grid rebinds and then it applies to all records universally. I think I am coming at this from the wrong direction. Is there a better way?
GridDataItem item = (GridDataItem)e.Item;
if
(_currentDate < DateTime.Today && _currentDate !=
null
)
{
((RadGrid)(item.Parent.Parent.Parent)).MasterTableView.DetailTables[0].CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None;
((RadGrid)(item.Parent.Parent.Parent)).MasterTableView.DetailTables[1].CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None;
((RadGrid)(item.Parent.Parent.Parent)).MasterTableView.DetailTables[2].CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None;
}