Telerik Extensions for ASP.NET MVC

Version Q2 2012, released 06/07/2012

Column Settings

Product NameUnit PriceUnits In StockLast SupplyDiscontinuedCommands
Chai$18.00396/19/2013Edit
Chang$19.00176/19/2013Edit
Aniseed Syrup$10.00136/19/2013Edit
Chef Anton's Cajun Seasoning$22.00536/19/2013Edit
Chef Anton's Gumbo Mix$21.3506/19/2013Edit
Grandma's Boysenberry Spread$25.001206/19/2013Edit
Uncle Bob's Organic Dried Pears$30.00156/19/2013Edit
Northwoods Cranberry Sauce$40.0066/19/2013Edit
Mishi Kobe Niku$97.00296/19/2013Edit
Ikura$31.00316/19/2013Edit
Displaying items 1 - 10 of 77

About this example ASPXRazor

This example shows how to configure the grid columns from the controller.

  1. Create an array of GridColumnSettings objects:
    var columns = new[] 
    {
        new GridColumnSettings
        {
            Member = "ProductName",
            Width = "130px"
        },
        new GridColumnSettings
        {
            Member = "UnitPrice",
            Width = "130px",
            Format = "{0:c}",
        },
        new GridCommandColumnSettings
        {
            Commands = 
            {
                new GridEditActionCommand(),
                new GridDeleteActionCommand()
            },
            Width = "200px",
            Title = "Commands"
        }
    };
    
  2. Store it in ViewData
    ViewData["columns"] = columns;
    
  3. Configure the grid using the LoadSettings method
    <%= Html.Telerik().Grid(Model)
            .Name("Grid")
            .Columns(columns => columns.LoadSettings((IEnumerable<GridColumnSettings<EditableProduct>>)ViewData["Columns"]))
    %>
    

Interested in HTML5 and mobile-powered ASP.NET MVC apps?

Experience the next generation UI and framework for ASP.NET MVC development by downloading trial evaluation copy of Kendo UI Complete for ASP.NET MVC. Jumpstart your development with the available learning resources.

The differences between Telerik MVC Extensions and Kendo UI Complete for ASP.NET MVC, and their licensing models are explained here and here.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Other Demos: