Skip to main content
Tab

ASPxGridExportSettings.EnableClientSideExportAPI Property

Gets or sets a value specifying whether the client exporting API is enabled.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

Declaration

[DefaultValue(false)]
public bool EnableClientSideExportAPI { get; set; }

Property Value

Type Default Description
Boolean false

true, to enable client exporting API; otherwise, false.

Remarks

Exporting grid data using built-in toolbar/context menu commands and client-side API is disabled by default due to possible security issues. To enable such grid exporting functionality, set the EnableClientSideExportAPI property to true.

The following examples illustrate how to use the EnableClientSideExportAPI property.

ASPxGridView

Examples

  • Export using built-in toolbar commands

    <dx:ASPxGridView ID="Grid" runat="server" KeyFieldName="ProductID" DataSourceID="ProductsDataSource" Width="100%"> 
    <SettingsExport EnableClientSideExportAPI="true"></SettingsExport>
        <Toolbars> 
        <dx:GridViewToolbar EnableAdaptivity="true"> 
                <Items> 
                    <dx:GridViewToolbarItem Command="ExportToXls" /> 
                    <dx:GridViewToolbarItem Command="ExportToXlsx" /> 
                    <dx:GridViewToolbarItem Command="ExportToCsv" /> 
                </Items> 
            </dx:GridViewToolbar> 
        </Toolbars> 
        <Columns> 
        ...
        </Columns> 
    </dx:ASPxGridView> 
    
  • Export using context menu commands

    <dx:ASPxGridView runat="server" ID="Grid" ClientInstanceName="Grid" Width="100%" EnableRowsCache="false" DataSourceID="DemoDataSource1" KeyFieldName="ProductID"
        OnContextMenuInitialize="Grid_ContextMenuInitialize">
        <Columns>
        ...
        </Columns>
        <SettingsExport EnableClientSideExportAPI="true" ExcelExportMode="DataAware" />
        <SettingsContextMenu Enabled="true" />
        ...
    </dx:ASPxGridView>
    
  • Export using client-side export API

    <dx:ASPxGridView ClientInstanceName="grid" ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" KeyFieldName="ProductID"> 
    <SettingsExport EnableClientSideExportAPI="true" /> 
            <Columns> 
            ...
            </Columns> 
    </dx:ASPxGridView> 
    <br /> 
    <dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Export"> 
        <ClientSideEvents Click="function(s, e) {
            grid.ExportTo(ASPxClientGridViewExportFormat.Xls);
        }" /> 
    </dx:ASPxButton>
    

Concept

Online Demos

ASPxCardView

Examples

  • Export using built-in toolbar commands

    <dx:ASPxCardView ID="cardView" runat="server" DataSourceID="ProductsDataSource" KeyFieldName="ProductID" AutoGenerateColumns="False">
        <Toolbars>
            <dx:CardViewToolbar EnableAdaptivity="true">
                <Items>
                    <dx:CardViewToolbarItem Command="ExportToPdf" />
                    <dx:CardViewToolbarItem Command="ExportToXls" />
                    <dx:CardViewToolbarItem Command="ExportToXlsx" />
                    <dx:CardViewToolbarItem Command="ExportToDocx" />
                    <dx:CardViewToolbarItem Command="ExportToRtf" />
                </Items>
            </dx:CardViewToolbar>
        </Toolbars>
        <Columns>
        ...
        </Columns>
        <SettingsExport EnableClientSideExportAPI="true" CardWidth="300" />
    </dx:ASPxCardView>
    
  • Export using client-side export API

    <dx:ASPxCardView ID="ASPxCardView1" ClientInstanceName="cardView" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" KeyFieldName="ProductID"> 
    <SettingsExport ExportSelectedCardsOnly="True" EnableClientSideExportAPI="true"></SettingsExport> 
        <Columns> 
        ...
        </Columns> 
    </dx:ASPxCardView> 
    <br /> 
    <dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Export"> 
        <ClientSideEvents Click="function(s, e) {
            cardView.ExportTo(ASPxClientCardViewExportFormat.Xls);
        }" /> 
    </dx:ASPxButton>
    

Concept

Online Demos

ASPxVerticalGrid

Examples

  • Export using built-in toolbar commands

    <dx:ASPxVerticalGrid ID="VerticalGrid" runat="server" DataSourceID="ProductsDataSource" EnableRecordsCache="false" Width="100%">
        <Toolbars>
            <dx:VerticalGridToolbar EnableAdaptivity="true">
                <Items>
                    <dx:VerticalGridToolbarItem Command="ExportToPdf" />
                    <dx:VerticalGridToolbarItem Command="ExportToXls" />
                    <dx:VerticalGridToolbarItem Command="ExportToXlsx" />
                    <dx:VerticalGridToolbarItem Command="ExportToDocx" />
                    <dx:VerticalGridToolbarItem Command="ExportToRtf" />
                </Items>
            </dx:VerticalGridToolbar>
        </Toolbars>
        ...
        <SettingsExport EnableClientSideExportAPI="true" />
    </dx:ASPxVerticalGrid>
    
  • Export using client-side export API

    <dx:ASPxVerticalGrid ClientInstanceName="verticalGrid" ID="ASPxVerticalGrid1" runat="server" Width="700px" AutoGenerateRows="False" DataSourceID="SqlDataSource3" KeyFieldName="ProductID"> 
    <SettingsExport EnableClientSideExportAPI="true"></SettingsExport> 
        <Rows> 
        ...
        </Rows> 
    </dx:ASPxVerticalGrid> 
    <br /> 
    <dx:ASPxButton ID="ASPxButton1" runat="server" AutoPostBack="False" Text="Export"> 
        <ClientSideEvents Click="function(s, e) {
            verticalGrid.ExportTo(ASPxClientVerticalGridExportFormat.Xls);
        }" /> 
    </dx:ASPxButton> 
    

Concept

ASPxVerticalGrid - Export

Online Demo

See Also