# Using Nested Model Properties

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>ASP.NET MVC Grid</td>
 </tr>
 <tr>
  <td>Operating System</td>
  <td>All</td>
 </tr>
 <tr>
  <td>Browser</td>
  <td>All</td>
 </tr>
 <tr>
  <td>Browser Version</td>
  <td>All</td>
 </tr>
</table>

## Description

How can I use nested Model properties in the ASP.NET MVC's Grid?

## Solution

To bind a column of the Grid to a Model with nested properties you need to use a Custom DataSource which allows you to configure the `[From](https://docs.telerik.com/aspnet-mvc/api/kendo.mvc.ui.fluent/customdatasourcemodelfielddescriptorbuilder#fromsystemstring)` configuration property of the `[schema.model.field](https://docs.telerik.com/aspnet-mvc/api/kendo.mvc.ui.fluent/customdatasourcemodeldescriptorfactory#fieldsystemstring)`.

In addition when you use `From` together with CRUD operations and add new rows, you also have to define in `Schema.Model.Field` the original field or the sequence of nested fields which are used inside `From`.

The reason is that during updates and creates, the Telerik UI DataSource tries to construct a data item object which matches the original (server-side) data-item structure. For new data items, such a structure does not exist and needs to be defined explicitly.

```Razor
  ...
  .DataSource(ds => ds
              .Custom()
              .PageSize(20)
              .ServerFiltering(false)
              .Schema(schema =>
                  schema.Model(model =>
                  {
                    model.Id(id => id.Name);
                    model.Field(f => f.Name);
                    model.Field(f => f.Description).From("Description.Text");
                }).Data("Data").Total("Total")
            )
            .Transport(transport =>
            {
                transport.Read("Orders_Read", "Grid");
                transport.Update("Orders_Update", "Grid");
                transport.Create("Orders_Create", "Grid");
                transport.Destroy("Orders_Destroy", "Grid");
            })
    )
```

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

* [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)
