Hi,
I just tried dropping the WebExcelExporter onto a page with an grid I have been using. I have a button with a callback where I call WebExcelExporter1.Export(WebDataGrid1);. I see the code call is happening, but nothing is coming back on the web page response. Any ideas where I should start looking for my problem?
Thank you,
Ross
Hi rbailey003,
By default when you call export method and pass a WebDataGrid as an argument the default dialog for browser downloading should pop-up with options open/save. Can you send us your sample to investigate more specific your problem.
Otherwise you can check our WebDataGrid Excel Export sample. There is code viewer at the bottom, this might help you too.
Thanks,
Hi Todor,
I tried catching first-chance Exceptions, and that tells me much more. I gather that having checkboxes in templated columns can cause problems. Is there a work-around for this (besides creating a second hidden grid without the checkboxes?). Is there a way to tell the exporter to ignore the columns with checkboxes? I tried using the GridFieldCaptionExporting and CellExporting events to cancel work on those columns, but I'm still not getting any results.
<ig:WebExcelExporter ID="RequestHistoryExcelExporter" runat="server"
DataExportMode="AllDataInDataSource"
DownloadName="GlobalCompRequestHistory" Visible="False">
</ig:WebExcelExporter>
<ig:WebDataGrid ID="dgRequestSubmit" runat="server"
Height="450px" Width="954px" DataKeyFields="KeyString"
onrowupdating="dgRequestSubmit_RowUpdating" AutoGenerateColumns="False" EnableAjaxViewState="False"
onprerender="dgRequestSubmit_PreRender" EnableViewState="False"
EnableAjax="False" DefaultColumnWidth="100px">
<EditorProviders>
<ig:TextEditorProvider ID="CommentEditProvider">
<editorcontrol maxlength="255">
</editorcontrol>
</ig:TextEditorProvider>
</EditorProviders>
<Columns>
<ig:BoundDataField DataFieldName="KeyString" Hidden="True" Key="KeyString">
<Header Text="KeyString" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="HasNoData" Hidden="true" Key="HasNoData">
<Header Text="HasNoData" />
<ig:BoundDataField DataFieldName="Selected" Hidden="true" Key="Selected">
<Header Text="Selected" />
<ig:TemplateDataField Key="chkSelected" Width="50px">
<ItemTemplate>
<asp:CheckBox ID="chkSelectToSubmit" runat="server"
Checked='<%# Eval("Selected") %>'
oncheckedchanged="chkSelectToSubmit_CheckedChanged" onclick="myselectRow(wdg, this)"/>
</ItemTemplate>
<HeaderTemplate>
<div class="CheckColumn_header">
<input type="checkbox" onclick="myselectFirstColumn(wdg,event)" /></div>
</HeaderTemplate>
</ig:TemplateDataField>
<ig:BoundDataField DataFieldName="AssigneeDescription"
Key="AssigneeDescription" Width="300px">
<Header Text="Assignee" />
<ig:BoundDataField DataFieldName="RequestDescription"
Key="RequestDescription" Width="175px">
<Header Text="Request Period" />
<ig:BoundDataField DataFieldName="NumPaymentsForFollowUp" Key="NumPaymentsForFollowUp" Width="75px" Hidden="true">
<Header Text="Payments Follow Up" />
<ig:BoundDataField DataFieldName="NumPaymentsInReview" Key="NumPaymentsInReview" Width="75px" Hidden="true">
<Header Text="Payments In Review" />
<ig:BoundDataField DataFieldName="NumPaymentsAccepted" Key="NumPaymentsAccepted" Width="75px" Hidden="true">
<Header Text="Payments Accepted" />
<ig:BoundDataField DataFieldName="NumPaymentsRejected" Key="NumPaymentsRejected" Width="75px" Hidden="true">
<Header Text="Payments Rejected" />
<ig:BoundDataField DataFieldName="NumPaymentsToSubmit"
Key="NumPaymentsToSubmit" Width="75px">
<Header Text="Payments to Submit" />
<ig:TemplateDataField Key="chkHasNoData" Width="95px">
<asp:CheckBox ID="chkHasNoData" runat="server"
Checked='<%# Eval("HasNoData") %>'
oncheckedchanged="chkHasNoData_CheckedChanged" onclick="saveHasNoData(wdg, this)"/>
<Header Text="No Data This Period" />
<ig:BoundDataField DataFieldName="Comment" Key="Comment" Width="250px">
<Header Text="Comment" />
</Columns>
<ClientEvents Initialize="dgRequestSubmit_Initialize" AJAXResponse="dgRequestSubmit_AJAXResponse" />
<Behaviors>
<ig:EditingCore BatchUpdating="True">
<ig:CellEditing>
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="AssigneeDescription" ReadOnly="True" />
<ig:EditingColumnSetting ColumnKey="RequestDescription" ReadOnly="True" />
<ig:EditingColumnSetting ColumnKey="NumPaymentsToSubmit" ReadOnly="True" />
<ig:EditingColumnSetting ColumnKey="KeyString" ReadOnly="True" />
<ig:EditingColumnSetting ColumnKey="Comment" EditorID="CommentEditProvider"/>
</ColumnSettings>
<EditModeActions EnableOnKeyPress="True" />
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
<ig:Activation>
</ig:Activation>
<ig:ColumnFixing>
</ig:ColumnFixing>
<ig:ColumnMoving>
</ig:ColumnMoving>
<ig:Filtering>
</ig:Filtering>
</ig:WebDataGrid>
Thank you, that will help. I found the cause of my problem, though, which was that the export button was inside an UpdatePanel control. I registered the button to do a full post-back, and the export worked.
Hello Rbailey003
In the “CellExporting” event of the WebExcelExporter you can hide a column before it exports .The below code hides columns with index 0 in Exporting event:
this.WebDataGrid2.Columns[0].Hidden = true;
Please let me know if you have any further questions regarding this matter.
Sincerely,
Prabha
Developer Support Engineer
Infragistics, Inc
www.infragistics.com/support