ComponentOne
Web API Explorer ASP.NET Web API Explorer

MVCFlexGrid

Virtual Scrolling

This sample demonstrates how to export a virtual scrolling mvc FlexGrid to excel file.

Features

ID
Start
End
Country
Product
Color
Amount
Amount2
Discount
Active
Rank
1
1/25/2025
1/25/2025
German
Gadget
Green
581.61
-2,939.67
0.14
4
2
2/25/2025
2/25/2025
Canada
Gadget
Green
4,919.02
-4,673.75
0.17
2

Settings


Export
Export Name :

Description

This sample demonstrates how to export a virtual scrolling mvc FlexGrid to excel file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using WebApiExplorer.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
 
namespace WebApiExplorer.Controllers
{
    public partial class MVCFlexGridController : Controller
    {
        private readonly GridExportImportOptions _flexGridVirtualScrollingModel = new GridExportImportOptions
        {
            NeedExport = true,
            NeedImport = false,
            IncludeColumnHeaders = true
        };
 
        public ActionResult VirtualScrolling()
        {
            ViewBag.Options = _flexGridVirtualScrollingModel;
            return View(Sale.GetData(1000));
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@using WebApiExplorer.Models
@model IEnumerable<Sale>
 
@{
    GridExportImportOptions optionsModel = ViewBag.Options;
    ViewBag.DemoSettings = true;
}
 
@(Html.C1().FlexGrid<Sale>().Id(optionsModel.ControlId)
    .Bind(bl => bl.InitialItemsCount(100).Bind(Model))
    .IsReadOnly(true)
    .CssClass("grid")
)
 
@section Settings{
    @Html.Partial("_FlexGridOptions", optionsModel)
}
 
@section Description{
    <p>@Html.Raw(Resources.MVCFlexGrid.VirtualScrolling_Text0)</p>
}