I understand that a Ajax grid exporting to excel must be handled differently. In my research I found there are two ways to accomplish this. The only the remotely works is this
Adding this Javascript to the aspx page
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(initRequest);
function initRequest(sender, args) {
if (args.get_postBackElement().id.indexOf("btnExportGrid") != -1) {
args.set_cancel(true); //stop async request
sender._form["**EVENTTARGET"].value = args.get_postBackElement().id.replace(/\_/g, "$");
sender._form["**EVENTARGUMENT"].value = "";
sender._form.submit();
return;
}
}
The problem is I get the following Javascript error
0x800a138f - JavaScript runtime error: Unable to set property 'value' of undefined or null reference
If I hit continue the grid exports. if I comment line out I get same error on the next line. I comment that out the export does not work.