Hi,
I am using RadGrid from telerik version 2012.1.215.40.
I have two methods RadGrid_NeedDataSource and Page_Prerender event
I am trying to hide AddNewrecordButton based on user permissions
This code doesn't hide the AddNewRecordButton from the grid.
But if i write the same code in RadGrid_NeedsdataSource event, it works. I also tried radGrid_PreRender event but that also not working.
If i add RadGrid.Rebind() method in prerender event, it works. But it fires the NeedsdataSource event again that i don't want.
All my code to hide/show controls based on the permissions is inside the PreRender event. So i don't want to use NeedsDataSource event just for hide/show of Add new record button.
Please suggest what is wrong with the PreRender event.
I am using RadGrid from telerik version 2012.1.215.40.
I have two methods RadGrid_NeedDataSource and Page_Prerender event
I am trying to hide AddNewrecordButton based on user permissions
protected
override
void
OnPreRender(EventArgs e)
{
try
{
//Hide controls on the page based on permission
//Code to hide control
// code to hide RadGrid AddNewRecordButton
RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton =
false
;
}
base
.OnPreRender(e);
}
catch
(Exception ex)
{
HandleException(ex, ErrorControl);
}
}
This code doesn't hide the AddNewRecordButton from the grid.
But if i write the same code in RadGrid_NeedsdataSource event, it works. I also tried radGrid_PreRender event but that also not working.
If i add RadGrid.Rebind() method in prerender event, it works. But it fires the NeedsdataSource event again that i don't want.
All my code to hide/show controls based on the permissions is inside the PreRender event. So i don't want to use NeedsDataSource event just for hide/show of Add new record button.
Please suggest what is wrong with the PreRender event.