This example illustrates how to use the ExportTo* methods to export the GridView 's content in different formats.
Note the following key points when you export GridView extension content:
- Define the GridView extension in a separate PartialView (TypedListDataBindingPartial.cshtml) without any additional tags.
- Wrap the GridView's PartialView in a form to apply the client's layout state (sorting, filtering, etc.).
@using(Html.BeginForm("ExportTo", "Home")) { // ... @Html.Partial("TypedListDataBindingPartial", Model) }
- Make a POST request to submit this form to the corresponding Controller Action.
- The GridViewSettings (especially the Name property) should be the same in PartialView and Controller;
- The data source/Model should be the same in PartialView and Controller.
- HomeController.cs (VB: HomeController.vb)
- Index.cshtml (VB: Index.vbhtml)
(you will be redirected to DevExpress.com to submit your response)