# Make Grid Columns Conditionally Editable

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Telerik UI for ASP.NET MVC Grid</td>
 </tr>
 <tr>
  <td>Product version</td>
  <td>2025.1.227</td>
 </tr>
</table>

## Description

How can I make specific Grid columns editable or non-editable based on condition?

## Solution

The columns in the Telerik UI for ASP.NET MVC Grid provide the [`Editable`](https://www.telerik.com/aspnet-mvc/documentation/api/kendo.mvc.ui.fluent/gridboundcolumnbuilder#editablesystemstring) property that accepts a JavaScript function name.

By default, the current `dataItem` is passed to the JavaScript method as an argument. You can use this argument to access the values of the respective model.

The following example demonstrates how to enable or disable the editing of the **ProductName** column based on the value of the **ProductID** field.

1. Add the `Editable` property for a Grid column and specify the name of the JavaScript method.

   ```Razor HtmlHelper
   @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.ProductViewModel>()
       .Name("grid")
       .Columns(columns =>
       {
           columns.Bound(p => p.ProductName).Editable("productNameEditable");
           ... // Other columns.
       })
       .DataSource(dataSource => dataSource
           .Ajax()
           .Model(model => model.Id(p => p.ProductID))
           ... // Settings omitted for brevity.
       )
       ... // Settings omitted for brevity.
   )
   ```

2. Add logic in the JavaScript function to determine if the column must be editable.

   ```JS
   <script>
       function productNameEditable(dataItem) {
           // Do not allow editing of "ProductName" field for the record with "ProductID" that equals "3".
           return dataItem.ProductID != 3;
       }
   </script>
   ```

## 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 Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
