Telerik Extensions for ASP.NET MVC

Defines the columns of the grid.

Namespace: Telerik.Web.Mvc.UI.Fluent
Assembly: Telerik.Web.Mvc (in Telerik.Web.Mvc.dll) Version: 2012.2.611.235 (2012.2.611.235)

Syntax

C#
public GridBuilder<T> Columns(
	Action<GridColumnFactory<T>> configurator
)
JavaScript
function Columns(configurator);

Parameters

configurator
Type: System..::..Action<(Of <(<'GridColumnFactory<(Of <(<'T>)>)>>)>)>
The add action.

Examples

CopyC#
 <%= Html.Telerik().Grid()
            .Name("Grid")
            .Ajax(ajax => ajax.Action("_RelatedGrids_Orders", "Grid", new { customerID = "ALFKI" }))
            .Columns(columns=>
            {
                columns.Add(c => c.OrderID).Width(100);
                columns.Add(c => c.OrderDate).Width(200).Format("{0:dd/MM/yyyy}");
                columns.Add(c => c.ShipAddress);
                columns.Add(c => c.ShipCity).Width(200);
            })
            .BindTo((IEnumerable<Order>)ViewData["Orders"]);
%>

See Also