I have an ajaxified grid that sits in a content page. The master page has a RadScriptManager tag and the content page has a ScriptManagerProxy tag. In the grid, I'm using the CommandItemSettings tag to display my Export to Excel buttons...
I understand that I need to turn Ajax off for these buttons so that the export actually works. I'm trying to turn them off from the code behind using the following code...
but I get an error:
Value cannot be null.
I can't seem to figure out if I just don't have the name of the button's correct or if I have the ScriptManager setup wrong. Can you give me a hand with this? Thanks.
<
CommandItemSettings
ShowAddNewRecordButton
=
"true"
AddNewRecordImageUrl
=
"../../App_Themes/InfoSource/Images/ico_add_24.png"
AddNewRecordText
=
"Add a Request"
ShowExportToExcelButton
=
"true"
ExportToExcelImageUrl
=
"../../App_Themes/InfoSource/Images/ico_excel_24.png"
ExportToExcelText
=
"Export to Excel"
ShowExportToPdfButton
=
"true"
ExportToPdfImageUrl
=
"../../App_Themes/InfoSource/Images/ico_acrobat_24.png"
ExportToPdfText
=
"Export to PDF"
ShowRefreshButton
=
"true"
RefreshImageUrl
=
"../../App_Themes/InfoSource/Images/ico_refresh_24.png"
RefreshText
=
"Refresh"
/>
I understand that I need to turn Ajax off for these buttons so that the export actually works. I'm trying to turn them off from the code behind using the following code...
if
(e.Item
is
GridCommandItem)
{
ScriptManager scriptManager = ScriptManager.GetCurrent(
this
.Page);
Button btncmd = (e.Item
as
GridCommandItem).FindControl(
"ExportToExcelButton"
)
as
Button;
scriptManager.RegisterPostBackControl(btncmd);
btncmd = (e.Item
as
GridCommandItem).FindControl(
"ExportToPdfButton"
)
as
Button;
scriptManager.RegisterPostBackControl(btncmd);
}
but I get an error:
Value cannot be null.
Parameter name: control
scriptManager.RegisterPostBackControl(btncmd);
I can't seem to figure out if I just don't have the name of the button's correct or if I have the ScriptManager setup wrong. Can you give me a hand with this? Thanks.