Ok, I've got a grid like so-
@(Html.Kendo().Grid<Honovi.ACT.MVCCore.Models.Bond>()
.Name( "GridBond" )
.Columns( columns =>
{
//columns.Bound ( p => p.BondBotyNumber ).ClientTemplate ( " #= BondBotyNumberNavigation ? BondBotyNumberNavigation.BotyDesc : '' # " ).Title ( "Type" ); // works for edit but clicking add button fails
//columns.Bound (p => p.BondBodyNumber.BodyDesc) // works for edit but clicking add button fails
columns.Bound( p => p.BondBotyNumber ); works, but I want display the description here
// Bunch of other columns
columns.Command( command => { command.Edit(); command.Destroy(); } ).Width( 172 );
} )
.ToolBar( toolbar => toolbar.Create() )
.Editable( editable => editable.Mode( GridEditMode.PopUp ).TemplateName( "_Bond" ).Window( w =>
w.Title( "\uD83D\uDD89 Manage Bonds" )
.Name( "winRate" )
.Width( 560 )
) )
.Selectable( selectable => selectable.Mode( GridSelectionMode.Single ) )
.Pageable()
.Sortable()
.DataSource( dataSource => dataSource
.Ajax()
.PageSize( 10 )
.Model( model => model.Id( p => p.BondGuid ) )
.Events( events => events.Error( "error_handler" ) )
.ServerOperation( false )
.Read( read => read.Action( "Bonds_Grid_Read", "Bonds", new { corpGuid = Model.CorpGuid } ) )
.Update( update => update.Action( "Bonds_Grid_Update", "Bonds" ) )
.Create( update => update.Action( "Bonds_Grid_Create", "Bonds", new { corpGuid = Model.CorpGuid } ) )
.Destroy( update => update.Action( "Bonds_Grid_Destroy", "Bonds" ) )
)
)
The problem I'm having is with the column. It is a navigation property on my model that is a foreign key that relates back to another model that is just an int / string that is used for a drop down. On the grid the edit button works fine. But when I click the add button nothing happens and I get the following js error in the console-
ReferenceError: BondBotyNumberNavigation is not defined[Learn More] kendo.all.min.js%20line%2025%20%3E%20Function:3:66
If I comment out the offending navigation property and just use the int value (as above) the add button works and I get no error.
Note I'm using with EditMode.Popup if that matters. Also I can post model code and such but it is pretty vanilla so I'm thinking I'm missing something more basic.
A little help! Thanks.