ASP.NET MVC Controls | ComponentOne
Working with Controls / FlexGrid / Work with FlexGrid / Data Binding / OData Binding
In This Topic
    OData Binding
    In This Topic

    OData model is a server-side model which provides the complete data at the server side. To apply OData binding in FlexGrid, you need to specify the service url, table name, and keys property. This topic describes how to add data to FlexGrid using OData binding.

    The following image shows how the FlexGrid control appears after implementing the code below.

    Controller Code

    Copy Code
    // GET: FlexGrid
    public ActionResult Index()
        return View();

    View Code

    Copy Code
            .CssStyle("height", "300px")
            .BindODataSource(odsb =>
            .Columns(csb =>
                csb.Add(cb => cb.Binding("ProductID").Width("*"));
                csb.Add(cb => cb.Binding("ProductName").Width("*"));
                csb.Add(cb => cb.Binding("QuantityPerUnit").Width("*"));
                csb.Add(cb => cb.Binding("UnitsInStock").Width("*"));
            .Filterable(fb => fb.DefaultFilterType(FilterType.Both)))