Hi there,
In my project I want to export a grid, and in documentation this looks like very simple task, but it doesn't work in my case and the error doesn't mean anything.
// This is my DocumentExporter and my Grid
<igtbldocexp:UltraWebGridDocumentExporter ID="UltraWebGridDocumentExporter1" runat="server" DataExportMode="DataInGridOnly" TargetPaperSize="A4" /><igtbl:UltraWebGrid ID="GridDocumentLibrary" SkinID="uwgStandart" runat="server" Width="100%" OnPreRender="GridDocumentLibrary_OnPreRender"><Bands> <igtbl:UltraGridBand> <Columns> <igtbl:TemplatedColumn BaseColumnName="CheckB" Key="CheckB" Type="CheckBox" DataType="System.Boolean" AllowUpdate="Yes" Width="5%"> <HeaderTemplate> <input id="chboxDocLibraryHeaderCheck" type="checkbox" onclick="COMMON_checkHeader_OnClick_CheckB('<%= GridDocumentLibrary.ClientID %>',this)" /> </HeaderTemplate> </igtbl:TemplatedColumn> <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="Regarding" GatherFilterData="False" Key="Regarding" Width="30%"> <Header Caption="HeaderRegarding" /> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="FileName" GatherFilterData="False" HeaderClickAction="Select" Key="FileName" Width="28%"> <Header Caption="HeaderFileName" /> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="FileUrl" GatherFilterData="False" HeaderClickAction="Select" Key="FileUrl" Hidden="True" /> <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="RegardingTypeKey" GatherFilterData="False" HeaderClickAction="Select" Key="RegardingTypeKey" Hidden="True" /> <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="EntityType" GatherFilterData="False" HeaderClickAction="Select" Key="EntityType" Hidden="True" /> <igtbl:TemplatedColumn Key="Chat" Width="5%" BaseColumnName="Chat" HeaderClickAction="Select" > <CellTemplate> <asp:Image ID="imgChat" runat="server" ImageUrl="~/Image/ico_16_9.gif" Visible='<%# Utils.CheckOnlineUsers(Utils.StringToGuid(Container.Cell.Text)) %>' /> </CellTemplate> </igtbl:TemplatedColumn> </Columns> </igtbl:UltraGridBand> </Bands></igtbl:UltraWebGrid>
// This is my C# code, that I found in the help
UltraWebGridDocumentExporter1.ExportMode = Infragistics.WebUI.UltraWebGrid.Exporter.ExportMode.Custom;UltraWebGridDocumentExporter1.Format = Infragistics.Documents.Report.FileFormat.PlainText;string s = @"d:\WebGrid2.txt";FileStream fileStream = File.OpenWrite(s);UltraWebGridDocumentExporter1.Export(GridDocumentLibrary, fileStream, true);
I don't know where is the problem, is it my TemplatedColumns (I check that, they won't be exported according the documentation, and that will be OK with me, if the exportation works).
I need to export at excell, pdf and plain text. Can anybody help me?
Regards, Iva
I want to add that I have ScriptManager on the page and the UltraWebGrid is in UpdatePanel and the UpdatePanel is in UserControl,
Is this is a problem
There would be a problem if you try to add the excelexporter inside the updatepanel...
because they dont work together
The short answer is that you need to trigger a full postback with your button click, rather than letting WARP or UpdatePanel turn the request into an asynchronous callback.
More details are provided in the following two forum threads:http://forums.infragistics.com/forums/t/8863.aspx (explains how to trigger a full postback using WARP)http://forums.infragistics.com/forums/t/19171.aspx (explains how to trigger a full postback using UpdatePanel)
Okay I understand that solution but, how can you acomplish this, if you have a button inside a WARP and you want to export to PDF?
1. I tried it and it displays the report inside the warp, instead of giving me the option to save it . I have the Export mode to ExportMode.Download
I even tried to put the function under a button outside the WARP and let the button inside the WARP trigger the click event , but it has the same effect. I think because the click event was raised inside the WARP, after the click event it returns to the control inside the WARP and there the thing goes wrong.
Is there a way to accomplish this.
2. And just another short question: how can i programmatically force a full-page postback of the WARP?
UpdatePanel expects a certain format of a response. WebGridExcelExporter takes over the response and provides the Excel file. Since UpdatePanel doesn't know what to do with an Excel file, it does nothing. The same applies when using WARP instead of UpdatePanel.
As a solution, you need to trigger your export process using a full-page postback.