# Changing Grid Height When Using Frozen Columns

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Grid for Progress® Telerik® UI for UI for ASP.NET MVC </td>
 </tr>
</table>

## Description

How can I resize a Telerik UI for ASP.NET MVC Grid which has frozen columns?

## Solution

The frozen column functionality requires the Grid to have fixed height. However, the suggested approach ensures that the Grid is able to calculate and construct its layout properly during resizing.

The following example demonstrates how to change the height style of the `div` wrapper element and then call the [`resize`](https://docs.telerik.com/kendo-ui/styles-and-layout/using-kendo-in-responsive-web-pages#individual-widget-resizing) method of the Grid.

```Razor Index.cshtml

<p>Group by the ShipCountry column and collapse some groups.</p>

@(Html.Kendo().Grid<GridHeightFrozenColumns.Models.OrderViewModel>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.OrderID).Filterable(false).Locked(true).Lockable(false).Width(150);
        columns.Bound(p => p.Freight).Width(150);
        columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}").Width(150);
        columns.Bound(p => p.ShipCountry).Width(150);
    })
    .Pageable()
    .Groupable()
    .Scrollable()
    .Height("550")
    .Events(ev =>
    {
        ev.DataBinding("onDataBinding");
        ev.DataBound("onDataBound");
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Read(read => read.Action("Orders_Read", "Grid"))
    )
)

```

```JS script.js

    function attachGroupResizeHandler(grid) {
        grid.wrapper.find(".k-grouping-row .k-icon").on("click", function () {
            resizeGrid(grid);
        });
    }
    function onDataBinding(e) {
        e.sender.wrapper.find(".k-grouping-row .k-icon").off("click")
    }
    function onDataBound(e) {
        attachGroupResizeHandler(e.sender); 
        resizeGrid(e.sender);
    }
    function resizeGrid(grid) {
        setTimeout(function () {
            var lockedContent = grid.wrapper.children(".k-grid-content-locked")
            var content = grid.wrapper.children(".k-grid-content");

            grid.wrapper.height("");
            lockedContent.height("");
            content.height("");

            grid.wrapper.height(grid.wrapper.height());

            grid.resize();
        });
    }

```

## More ASP.NET MVC Grid Resources

* [ASP.NET MVC Grid Documentation](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/overview)

* [ASP.NET MVC Grid Demos](https://demos.telerik.com/aspnet-mvc/grid/index)

* [ASP.NET MVC Grid Product Page](https://www.telerik.com/aspnet-mvc/grid)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Client-Side API Reference of the Grid for ASP.NET MVC](https://docs.telerik.com/kendo-ui/api/ui/grid)
* [Server-Side API Reference of the Grid for ASP.NET MVC](https://docs.telerik.com/aspnet-mvc/api/grid)
* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)
* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
