Tassadaque
Tassadaque

Reputation: 8199

Global settings for telerik mvc grid

Is there any way that i can set some formatting such as scrollable, width height of grid at application level that are applied to all the grids in the application so that I could avoid
changing every grid in application

Upvotes: 2

Views: 474

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30671

You can create a custom extension method for HtmlHelper and configure the grid there. Use that method instead. Here is some sample code:

public static class GridHtmlHelperExtensions
{        
        public static GridBuilder<T> Grid<T>(this HtmlHelper html) 
            where T : class
        {
            var builder = html.Telerik().Grid<T>();

            builder.Pageable();
            builder.Sortable();

            return builder;
        }
}

And then in your view:

<%: Html.Grid<MyModel>().Name("MyGrid") %>

Upvotes: 5

Related Questions