GridLayout Overview
The ASP.NET MVC GridLayout component allows you to arrange the contents of the component in rows and columns in a grid structure. The arrangement of content relies on the CSS Grid functionality. For more information on the CSS Grid, refer to the official CSS Grid documentation.
The GridLayout is part of Telerik UI for ASP.NET MVC, a
professional grade UI library with 110+ components for building modern and feature-rich applications. To try it out sign up for a free 30-day trial.
The GridLayout is supported only when you use Kendo UI themes.
Initializing the GridLayout
Use the Grid HtmlHelper to add the component and set the desired options:
- Use the
Rows
confiuguration option to define the number of rows and set individual row height, if desired. - Use the
Columns
confiuguration option to define the number of columns and set individual column width, if desired. - Use the
Items
configuration to position the items. Set theRow
,Column
,RowSpan
, andColumnSpan
options to adjust the position of an item. Refer to the Items article for further details on the configuration options for the GridLayout items.
The following example demonstrates how to initialize a GridLayout with three rows and three columns:
@(Html.Kendo().GridLayout()
.Name("gridlayout")
.RowSpacing("6px")
.ColumnSpacing("10px")
.Rows(c=>{
c.Add().Height("20px");
c.Add().Height("100px");
c.Add().Height("100px");
})
.Columns(c=>{
c.Add().Width("300px");
c.Add().Width("300px");
c.Add().Width("300px");
})
.Items(i=>{
i.Add().Row(1).Column(1).ColumnSpan(3)
.Content("Header");
i.Add().Row(2).Column(1).ColumnSpan(2).RowSpan(2).Content("Some content here"));
i.Add().Row(2).Column(3)
.Content("<div class='myClass'>Other content here</div>");
i.Add().Row(3).Column(3).Content(
Html.Kendo().Calendar()
.Name("calendar")
.ToHtmlString());
)
})
)
Functionality and Features
-
Items—the
Items
configuration allows you to adjust each Item's position in the defined GridLayout. - Rows and columns—To configure the appearance of the GridLayout, you can use the
Rows
andColumns
configuration properties.