tags:

views:

374

answers:

1

Hi ! I have this jqGrid

<trirand:JQGrid runat="server" ID="JQGrid1" OnRowEditing="JQGrid1_RowEditing" 
    RenderingMode="Optimized" oncellbinding="JQGrid1_CellBinding" Height="350" EditUrl="/Ferramenta/Transacoes/TransacoesT.aspx">
    <AppearanceSettings HighlightRowsOnHover="true"/>
    <Columns>
        <trirand:JQGridColumn DataField="IdLancamento" PrimaryKey="True" Visible="false" />
        <trirand:JQGridColumn DataField="IdCategoria" Visible="false" />
        <trirand:JQGridColumn DataField="DataLancamento" Editable="true" DataFormatString="{0:dd/MM/yy}" HeaderText="Data" Width="65" TextAlign="Center" CssClass="font_data" />
        <trirand:JQGridColumn DataField="Descricao" Editable="true" HeaderText="Descrição" Width="330" />
        <trirand:JQGridColumn DataField="NomeCategoria" Editable="true" EditType="DropDown" EditorControlID="ddlCategorias" HeaderText="Categoria">
            <Formatter>
                <trirand:CustomFormatter FormatFunction="DefineUrl" />
            </Formatter>
        </trirand:JQGridColumn>                
        <trirand:JQGridColumn DataField="Valor" Editable="false" DataFormatString="{0:C}" HeaderText="Valor" Width="80" TextAlign="Center" />
    </Columns>
    <ClientSideEvents RowSelect="editRow" />
    <PagerSettings PageSize="20" />
    <ToolBarSettings ShowEditButton="false" ShowRefreshButton="True" ShowAddButton="false"
        ShowDeleteButton="false" ShowSearchButton="false" />
    <SortSettings InitialSortColumn=""></SortSettings>
</trirand:JQGrid>
<asp:LinkButton ID="lbExportar" runat="server" onclick="lbExportar_Click">Exportar todas as transações</asp:LinkButton>

When I use the method ExportToExcel

JQGrid1.ExportToExcel("export.xls");

it includes the first column IdLancamento that is not visible and also includes another column that is used on the query. Is it possible to choose the columns that are going to be exported ?

A: 

There does not appear to be a way to do this from the ASP.NET API. You may want to have a look at this article, which offers a different way to perhaps achieve the same result:

link 566_JQuery_jqGrid_Export_to_Excel_Using_ASP_NET_MVC_Framework

Justin Ethier