Hi Telerik Team,
I want to Export the Rad Grid data to the Excel Sheet, I have added a link button to the Rad Grid dynamically. For Exporting the Rad Grid data to the Excel Sheet i have placed the rad grid inside a "RadAjaxPanel", When i place the Rad grid Inside the RadAjaxPanel the entire data is being Exported to the Excel sheet, but the link button that i have added dynamically to the Rad grid is not doing any post back (My requirement is on clicking this link button it will get the DataKey and based on the DataKey value it will fetch the Records from the Database and display in the RadGrid in a POP-up), but when I remove the Rad Grid from the RadAjaxPanel the data is not being Exporting to the Excel Sheet it is giving the Following Error:
"Server Error in '/' Application.
Invalid postback or callback argument. Event validation is enabled using
<pages enableEventValidation="true"/> in configuration or <%@ Page
EnableEventValidation="true" %> in a page. For security purposes, this
feature verifies that arguments to postback or callback events originate from
the server control that originally rendered them. If the data is valid and
expected, use the ClientScriptManager.RegisterForEventValidation method in order
to register the postback or callback data for validation."
In this Case the Link Button that i have added dynamically is doing the Post back and displaying the Data in the Pop-up.
This is the Code that i am use for Rad Grid for opening pop-up on Link button Click:
"<telerik:RadGrid ID="rgAccountDetails" runat="server" AllowPaging="True" PageSize="10" AllowFilteringByColumn="True" AllowSorting="True" Visible="false"
Skin="Vista" OnPreRender="rgAccountDetails_PreRender" OnColumnCreated="rgAccountDetails_ColumnCreated" OnGridExporting="rgAccountDetails_GridExporting"
OnItemCommand="rgAccountDetails_ItemCommand" OnPageIndexChanged="rgAccountDetails_PageChanged"
OnExcelMLExportRowCreated="rgAccountDetails_ExcelMLExportRowCreated">
<ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
<Excel Format="ExcelML" />
<Pdf FontType="Subset" PaperSize="Letter" PageWidth="18in" PageHeight="150in" />
</ExportSettings>
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView DataKeyNames="AccountID" CommandItemDisplay="Top">
<CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true"
ShowExportToCsvButton="true" ShowAddNewRecordButton="false" ShowExportToPdfButton="True" />
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</MasterTableView>
</telerik:RadGrid>"
In the above code the link button is doing Post Back and fetching the data and display in the Pop-up, but Rad grid data is not exported to the Excel sheet.
"
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel2"
ClientEvents-OnRequestStart="requestStart" HorizontalAlign="NotSet">
<telerik:RadGrid ID="rgInvoicedetails" runat="server" AllowPaging="True"
PageSize="7" AllowFilteringByColumn="True" AllowSorting="True" Visible="False"
Skin="Vista" OnItemCommand="rgInvoicedetails_ItemCommand" OnColumnCreated="rgInvoicedetails_ColumnCreated"
OnPageIndexChanged="rgInvoicedetails_PageChanged" GridLines="None">
<PagerStyle Mode="NextPrevAndNumeric" />
<ExportSettings FileName="InvoiceReports" ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
<Excel Format="ExcelML" FileExtension="xlsx" />
<Pdf FontType="Subset" PaperSize="Letter" PageWidth="18in" PageHeight="150in" />
</ExportSettings>
<MasterTableView DataKeyNames="InvoiceID">
<CommandItemSettings ExportToPdfText="Export to Pdf" />
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>"
In the above code the link button is not doing Post Back and is not able fetching the data and display in the Pop-up, but the Grid data is Exported to the Excel Sheet.
Please help me.
Thanks,
Arvind.