I have a grid that looks like this:
@(Html.Kendo()
.Grid<ProjectName.TerminalOutOfState>()
.Name(
"manageTOSSqlRecordsGrid"
)
.Columns(columns =>
{
columns.Bound(c => c.TerminalOutOfStateID).Hidden();
columns.Bound(c => c.TerminalCompanyID).Title(
"Terminal ID"
).Width(60);
columns.Bound(c => c.CompanyID).Title(
"Region"
).ClientTemplate(
"#=CompanyName#"
).Width(40);
columns.Command(cmd =>
{
cmd.Edit();
cmd.Destroy();
cmd.Custom(
"Save"
).Visible(
"showSaveCommand"
).Click(
"saveTerminalRow"
);
}).Title(
"Action"
).Width(80);
})
.ToolBar(tbr =>
{
tbr.Create();
tbr.Custom().Text(
"Load the table"
);
})
.Editable(edt => edt.Mode(GridEditMode.PopUp).TemplateName(
"TOoSTemplate"
).CreateAt(GridInsertRowPosition.Top))
.DataSource(dataSrc => dataSrc
.Ajax()
.ServerOperation(
true
)
.PageSize(15)
.Model(mdl => mdl.Id(column => column.TerminalOutOfStateID))
.Create(update => update.Action(
"UpsertTerminalOoSRecordAsync"
,
"Configuration"
))
//omitted for brevity
)
.AutoBind(
false
)
)
My focus here is on the Region column. The kind of data it gets looks like this:
CompanyID: 1
Instead of showing just 1, I pass the Name for that Id on a variable called CompanyName and show it using ClientTemplate.
It all works and looks good until I either edit the row or add a new row and it shows null.
After I reload the table, then it shows the correct value.
Please look at my attached screenshots to get a better picture.