# Using Enum Type Fields in Grid

## 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 use configure the Telerik UI for ASP.NET MVC Grid to display and edit `enum` type fields?

## Solution

The example relies on the following key steps:

1. Define a Grid with a column that binds to a field of type `enum`:

   ```Razor HtmlHelper
       @(Html.Kendo().Grid<Product>()
           .Name("Grid")
           .Columns(columns =>
           {
               ...
               columns.Bound(p => p.Category);
           })
           .Editable(editable => editable.Mode(GridEditMode.InCell))
           ...
       )
   ```

2. The **Category** field is an Enumeration:

   ```C#
       public class Product
       {
           public Category Category { get; set; }
       }

       public enum Category
       {
           Beverages,
           Foods
       }
   ```

3. Create a custom editor template for the **Category** field:

   ```Razor HtmlHelper
   @model Category
   @using Kendo.Mvc.UI

   @{
       List<SelectListItem> list = new List<SelectListItem>();
       foreach (var value in Enum.GetValues(typeof(Telerik.Examples.Mvc.Areas.GridEditingAjaxWithEnumeration.Models.Category)))
       {
           list.Add(new SelectListItem()
           {

               Text = value.ToString(),
               Value = ((int)value).ToString()
           });
       }
   }

   @(Html.Kendo().DropDownListFor(m=> m)
       .DataTextField("Text")
       .DataValueField("Value")
       .BindTo(list)
   )
   ```

To review the complete example, refer to the ASP.NET MVC application on how to [configure the Grid to display and edit `enum` fields](https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/Telerik.Examples.Mvc/Telerik.Examples.Mvc/Areas/GridEditingAjaxWithEnumeration).

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