Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Using Ajax to bind data to FlexGrid in ASP.NET MVC

Background:

This article was inspired by a customer who wanted to automatically fill a FlexGrid with data coming from an SQL server.

Steps to Complete:

1. To load data into FlexGrid, apply the code snippet below:

$.ajax({
            url: '@Url.Action("GetData","Home")',
            method: 'GET',
            success: function (data) {
                var grid = wijmo.Control.getControl("#flexGrid");
                if (grid.collectionView.itemCount > 0) {
                    grid.collectionView.sourceCollection = data;
                    grid.collectionView.refresh();
                } else {
                    grid.itemsSource = data;
                }
            }
        });

2. Ensure that any column binding variables follow camelCase notation, for example:

<c1-flex-grid-column binding="reportGroupName"></c1-flex-grid-column>
<c1-flex-grid-column binding="forecastSet" header="Src"></c1-flex-grid-column>
Get the Latest Version of ASP.NET MVC Edition
Download the Free Trial Now