Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
Help with WebExcelExporter
posted

Could someone please help show me what I'm doing wrong in vb.net:

I am trying to incorporate a WebExcelExporter in my asp.net web site. I am able to get the my web site to compile, and I can get the webExcelExporter to open up a spreadsheet, but all I get in the spread sheet are my column headings.  No Data is present.

Here is my configuration:  I have two infragistics WebDataGrids,  'gvSales' and 'gvInventory'.  Each grid is on a separate UpdatePanel.  I copied the logic of the "Samples.infragistics.com" web site and came up with the following code for my button click event.

Dim fileName As String = HttpUtility.UrlEncode(tbFileName.Text)
        fileName = fileName.Replace("+", "%20")
        eExporter.DownloadName = fileName
        Me.eExporter.DataExportMode = DirectCast([Enum].Parse(GetType(DataExportMode), Me.rblExportData.SelectedValue), DataExportMode)
        Me.eExporter.WorkbookFormat = DirectCast([Enum].Parse(GetType(Infragistics.Excel.WorkbookFormat), Me.rblExcelFormat.SelectedValue), Infragistics.Excel.WorkbookFormat)
        Dim singleGridPerSheet As Boolean = If((Me.rblSheets.SelectedValue = "separate"), True, False)
        Me.eExporter.Export(singleGridPerSheet, gvSales, gvInventory)

 

Also:  Could someone please explain what these two lines are actually doing.

 


        Me.eExporter.DataExportMode = DirectCast([Enum].Parse(GetType(DataExportMode), Me.rblExportData.SelectedValue), DataExportMode)
        Me.eExporter.WorkbookFormat = DirectCast([Enum].Parse(GetType(Infragistics.Excel.WorkbookFormat), Me.rblExcelFormat.SelectedValue), Infragistics.Excel.WorkbookFormat)

 

Thanks

 

Dave.

Parents
No Data
Reply
  • 290
    posted

    Here is my html source if it helps.

     

     <fieldset style="height: 650px">
                <legend>Results:</legend>
                <ig:WebExcelExporter runat="server" ID="eExporter" ExportMode="Download"/>
                <div style="padding-top: 30px;">
                    <fieldset class="fieldset">
                        <legend class="icoExporter">Export Options</legend>
                        <fieldset class="fldOptions">
                            <legend>Format</legend>
                            <asp:RadioButtonList ID="rblExcelFormat" runat="server" AutoPostBack="false" ToolTip="WorkbookFormat - Determines the format of the exported excel file."
                                Width="249px">
                                <asp:ListItem Text="Excel 97-2003 Format" Value="Excel97To2003" />
                                <asp:ListItem Text="Excel 2007 Format" Value="Excel2007" Selected="True" />
                            </asp:RadioButtonList>
                        </fieldset>
                        <fieldset class="fldOptions">
                            <legend>Export Mode</legend>
                            <asp:RadioButtonList CssClass="props" ID="rblExportData" runat="server" AutoPostBack="false"
                                ToolTip="DataExportMode - whether the grid will export the entire set of data."
                                Width="217px">
                                <asp:ListItem Text="Export Visible Data" Value="DataInGridOnly" />
                                <asp:ListItem Text="Export All Data" Value="AllDataInDataSource" Selected="True" />
                            </asp:RadioButtonList>
                        </fieldset>
                        <fieldset class="fldOptions">
                            <legend>Sheets</legend>
                            <asp:RadioButtonList ID="rblSheets" runat="server" AutoPostBack="false" Width="259px">
                                <asp:ListItem Text="Export in Single Sheet" Value="single" Selected="True" />
                                <asp:ListItem Text="Export in separate Sheets" Value="separate" />
                            </asp:RadioButtonList>
                        </fieldset>
                        <div style="display: block; clear: both;" />
                        <br />
                        <div>
                            <asp:Label runat="server" ID="lblFileName" Text="Enter file name (w/o extension):" />
                            <asp:TextBox runat="server" ID="tbFileName" Text="ExportedData" Style="width: 612px;" />
                            <asp:Button runat="server" ID="btnExport1" Text="Export" CssClass="button" />
                        </div>
                    </fieldset>
                </div>
                    <center>
                        <br />
                        <div id="GridView">
                            <asp:UpdatePanel ID="updgvSales" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:Label ID="lbGrSales" runat="server" Text="Sales" Font-Size="Large"></asp:Label>
                                    <br>
                                    <ig:WebDataGrid ID="gvSales" runat="server" Height="250px" Width="80%" DefaultColumnWidth="200px"
                                        StyleSetName="Default">
                                        <ClientEvents Initialize="Init_gvSales" />
                                        <Behaviors>
                                            <ig:Paging PagerAppearance="Bottom" PageSize="200" QuickPages="3" Enabled="true"
                                                PagerMode="NumericFirstLast" />
                                            <ig:Filtering>
                                            </ig:Filtering>
                                            <ig:Sorting>
                                            </ig:Sorting>
                                            <ig:ColumnResizing Enabled="true">
                                                <ColumnSettings>
                                                    <ig:ColumnResizeSetting EnableResize="true" />
                                                </ColumnSettings>
                                            </ig:ColumnResizing>
                                            <ig:Selection>
                                            </ig:Selection>
                                            <ig:RowSelectors Enabled="true" RowNumbering="true" />
                                        </Behaviors>
                                        <ErrorTemplate>
                                            An Error has occured while trying to display the current query!
                                        </ErrorTemplate>
                                        <EmptyRowsTemplate>
                                            No Data Available for current query
                                        </EmptyRowsTemplate>
                                    </ig:WebDataGrid>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnViewSales" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="btnViewAll" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                            <br />
                            <asp:UpdatePanel ID="updgvInv" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <asp:Label ID="lbGrInv" runat="server" Text="Inventory" Font-Size="Large"></asp:Label>
                                    <br />
                                    <ig:WebDataGrid ID="gvInventory" runat="server" Height="250px" Width="80%" DefaultColumnWidth="200px"
                                        StyleSetName="Default">
                                        <ClientEvents Initialize="Init_gvInventory" />
                                        <Behaviors>
                                            <ig:Paging PagerAppearance="Bottom" PageSize="200" QuickPages="3" Enabled="true"
                                                PagerMode="NumericFirstLast" />
                                            <ig:Filtering>
                                            </ig:Filtering>
                                            <ig:Sorting>
                                            </ig:Sorting>
                                            <ig:ColumnResizing Enabled="true">
                                                <ColumnSettings>
                                                    <ig:ColumnResizeSetting EnableResize="true" />
                                                </ColumnSettings>
                                            </ig:ColumnResizing>
                                            <ig:Selection>
                                            </ig:Selection>
                                            <ig:RowSelectors Enabled="true" RowNumbering="true" />
                                        </Behaviors>
                                        <ErrorTemplate>
                                            An Error has occured while trying to display the current query!
                                        </ErrorTemplate>
                                        <EmptyRowsTemplate>
                                            No Data Available for current query
                                        </EmptyRowsTemplate>
                                    </ig:WebDataGrid>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnViewInv" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="btnViewAll" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                            <br />
                            <asp:UpdatePanel ID="updStatus" runat="server" UpdateMode="Conditional">
                                <ContentTemplate>
                                    <div id="imgStatus" style="position: absolute; left: 20px;">
                                        <table cellspacing="3">
                                            <tr>
                                                <td>
                                                    <asp:Image ID="imgResult" runat="server" ImageUrl="Styles/Images/Success.png" Height="16px"
                                                        Width="16px" />
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblImgText" runat="server" Text="" Style="font-size: 7pt;"></asp:Label>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnViewInv" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="btnViewAll" EventName="Click" />
                                    <asp:AsyncPostBackTrigger ControlID="btnViewSales" EventName="Click" />
                                </Triggers>
                            </asp:UpdatePanel>
                        </div>
                    </center>
            </fieldset>

Children