# Setting Conditional Grid Properties

## Environment

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

## Description

How can I set some of the Telerik UI for ASP.NET MVC Grid properties depending on a condition?

## Solution

You can achieve this requirement by defining the Grid to a variable instance and then apply the logic using `if` conditional statements. Finally, you can call the `.Render()` method to display the Grid.

```C#
@{
    var isAdmin = true;

    var grid = (Html.Kendo().Grid<KendoGridProject.Models.OrderViewModel>()
                 .Name("grid")
                 .Columns(columns =>
                 {
                     columns.Bound(p => p.OrderID).Filterable(false);
                     columns.Bound(p => p.Freight);
                     columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
                     columns.Bound(p => p.ShipName);
                     columns.Bound(p => p.ShipCity);
                 })
                 .Pageable()
                 .Scrollable()
                 .HtmlAttributes(new
                 {
                     style = "height:550px;"
                 })
                 .DataSource(dataSource => dataSource
                     .Ajax()
                     .PageSize(20)
                     .Model(m=>m.Id("OrderID"))
                     .Read(read => read.Action("Orders_Read", "Grid"))
                 )
             );

    if (isAdmin)
    {
        grid.Editable();
        grid.Sortable();
        grid.Filterable();
        grid.Sortable();
    }

    grid.Render();
}
```

## 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)
