MVCxGridExportSettings.EnableClientSideExportAPI Property
Gets or sets a value specifying whether the client exporting API is enabled.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
Boolean | true, to enable client exporting API; otherwise, false. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to EnableClientSideExportAPI |
---|---|
GridSettingsBase |
|
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.
MVCxGridView
Exporting using built-in toolbar commands
settings.SettingsExport.EnableClientSideExportAPI = true; settings.Toolbars.Add(t => { t.EnableAdaptivity = true; t.Items.Add(GridViewToolbarCommand.ExportToPdf); t.Items.Add(GridViewToolbarCommand.ExportToXls); });
Exporting using context menu commands
@using (Html.BeginForm("ExportTo", "Customization")) { @Html.Partial("ContextMenuPartial", Model) }
Exporting using client-side export API
@Html.DevExpress().GridView(settings => { settings.Name = "GridView"; settings.SettingsExport.EnableClientSideExportAPI = true; ... }).Bind(Model).GetHtml() ... <div class="button"> @Html.DevExpress().Button(s => { s.Name = "ExpBtn"; s.Text = "Export"; s.AutoPostBack = "false"; s.ClientSideEvents.Click = "function(s,e){ GridView.ExportTo(ASPxClientGridViewExportFormat.Xls);}"; }).GetHtml()
Note
Refer to the MVCxGridView Exporting topic to learn how to implement exporting within DevExpress ASP.NET MVC Grid View.
Online Demos
- Exporting Data
- Excel Data Aware Export
- Export Master-Detail Records
- Export with Format Conditions
- Export with Data Cell Bands
- Context Menu
MVCxCardView
Exporting using built-in toolbar commands
settings.SettingsExport.EnableClientSideExportAPI = true; settings.SettingsExport.CardWidth = 300; settings.Toolbars.Add(tb => { tb.EnableAdaptivity = true; tb.Items.Add(CardViewToolbarCommand.ExportToPdf); tb.Items.Add(CardViewToolbarCommand.ExportToXls); tb.Items.Add(CardViewToolbarCommand.ExportToXlsx); tb.Items.Add(CardViewToolbarCommand.ExportToDocx); tb.Items.Add(CardViewToolbarCommand.ExportToRtf); });
Exporting using client-side export API
@Html.DevExpress().CardView(settings => { settings.Name = "CardView"; settings.SettingsExport.EnableClientSideExportAPI = true; ... }).Bind(Model).GetHtml() ... <div class="button"> @Html.DevExpress().Button(s => { s.Name = "ExpBtn"; s.Text = "Export"; s.AutoPostBack = "false"; s.ClientSideEvents.Click = "function(s,e){ CardView.ExportTo(ASPxClientCardViewExportFormat.Xls);}"; }).GetHtml()
Note
Refer to the MVCxCardView Exporting topic to learn how to implement exporting within DevExpress ASP.NET MVC Card View.
Online Demos
MVCxVerticalGrid
Exporting using built-in toolbar commands
settings.SettingsExport.EnableClientSideExportAPI = true; settings.Toolbars.Add(tb => { tb.EnableAdaptivity = true; tb.Items.Add(VerticalGridToolbarCommand.ExportToPdf); tb.Items.Add(VerticalGridToolbarCommand.ExportToXls); tb.Items.Add(VerticalGridToolbarCommand.ExportToXlsx); tb.Items.Add(VerticalGridToolbarCommand.ExportToDocx); tb.Items.Add(VerticalGridToolbarCommand.ExportToRtf); });
Exporting using client-side export API
@Html.DevExpress().VerticalGrid(settings => { settings.Name = "VerticalGrid"; settings.SettingsExport.EnableClientSideExportAPI = true; ... }).Bind(Model).GetHtml() ... <div class="button"> @Html.DevExpress().Button(s => { s.Name = "ExpBtn"; s.Text = "Export"; s.AutoPostBack = "false"; s.ClientSideEvents.Click = "function(s,e){ VerticalGrid.ExportTo(ASPxClientVerticalGridExportFormat.Xls);}"; }).GetHtml()
Online Demo
Exporting to Different Formats