While I read many posts about this issue, none seem to fit my particular problem.
I have a very simple web form, with a grid, which is not ajaxified, in server side code, I call a complex object that returns a simple list of items as a datatable and set it as datasource for my grid. The grids works and displays all OK, however when I try to export to xlsx (and actually any supported format), nothing happens after calling MasterTableView.ExportToExcel().
I did verified that the grdWarranties items is not empty and that the datasource is not lost. Below substract of the web page and the server side code to execute the export:
Protected
Sub
btnExport_Click(sender
As
Object
, e
As
Telerik.Web.UI.ImageButtonClickEventArgs)
Handles
btnExport.Click
grdWarranties.Page.Response.ClearHeaders()
grdWarranties.Page.Response.Cache.SetCacheability(HttpCacheability.
Private
)
grdWarranties.ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.Xlsx
grdWarranties.ExportSettings.IgnorePaging =
False
grdWarranties.ExportSettings.ExportOnlyData =
True
grdWarranties.ExportSettings.OpenInNewWindow =
True
grdWarranties.MasterTableView.ExportToExcel()
End
Sub
<
asp:Panel
runat
=
"server"
>
<
table
class
=
"WarrantyCheckTable"
style
=
"margin-top:15px"
>
<
tr
>
<
td
style
=
"width:15%"
>
<
telerik:RadLabel
ID
=
"RadLabel1"
Text
=
"Type or paste in your Landis+Gyr serial numbers:"
runat
=
"server"
Font-Size
=
"Small"
Font-Italic
=
"True"
></
telerik:RadLabel
>
<
telerik:RadTextBox
ID
=
"txtMSNs"
runat
=
"server"
TextMode
=
"MultiLine"
BorderColor
=
"#7AB800"
BorderWidth
=
"1px"
Height
=
"93%"
Width
=
"100%"
Wrap
=
"False"
></
telerik:RadTextBox
>
</
td
>
<
td
style
=
"width:5%"
>
<
telerik:RadImageButton
ID
=
"btnGo"
runat
=
"server"
Text
=
"Go!"
Skin
=
"Telerik"
></
telerik:RadImageButton
>
</
td
>
<
td
>
<
telerik:RadGrid
ID
=
"grdWarranties"
runat
=
"server"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
ShowGroupPanel
=
"True"
Width
=
"100%"
ViewStateMode
=
"Enabled"
RenderMode
=
"Lightweight"
>
<
GroupingSettings
CollapseAllTooltip
=
"Collapse all groups"
/>
<
ExportSettings
ExportOnlyData
=
"True"
FileName
=
"WarrantyData"
OpenInNewWindow
=
"True"
>
<
Excel
FileExtension
=
"xlsx"
Format
=
"Xlsx"
/>
<
Csv
EncloseDataWithQuotes
=
"False"
/>
</
ExportSettings
>
<
ClientSettings
AllowDragToGroup
=
"True"
>
<
Scrolling
AllowScroll
=
"True"
ScrollHeight
=
"600px"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"MSN"
FilterControlAltText
=
"Filter colMSN column"
HeaderText
=
"MSN"
UniqueName
=
"colMSN"
>
<
FooterStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CSN"
FilterControlAltText
=
"Filter colCSN column"
HeaderText
=
"CSN"
UniqueName
=
"colCSN"
>
<
FooterStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"METERTYPE"
FilterControlAltText
=
"Filter colType column"
HeaderText
=
"Type"
UniqueName
=
"colType"
>
<
FooterStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CATALOG"
FilterControlAltText
=
"Filter colCatalog column"
HeaderText
=
"Catalog"
UniqueName
=
"colCatalog"
>
<
FooterStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SOLDDATE"
FilterControlAltText
=
"Filter colSoldDate column"
HeaderText
=
"Ship Date"
UniqueName
=
"colSoldDate"
DataFormatString
=
"{0:MMM dd, yyyy}"
DataType
=
"System.DateTime"
>
<
FooterStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"WARRANTY"
FilterControlAltText
=
"Filter colWarranty column"
HeaderText
=
"Warranty Status"
UniqueName
=
"colWarranty"
>
<
FooterStyle
HorizontalAlign
=
"Center"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
FilterMenu
RenderMode
=
"Lightweight"
>
</
FilterMenu
>
<
HeaderContextMenu
RenderMode
=
"Lightweight"
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
</
td
>
</
tr
>
</
table
>
</
asp:Panel
>