This question is locked. New answers and comments are not allowed.
Here is my grid definition:
And here is the editor template:
I'm using this type of setup in several places and it works just fine. But here, for somereason, when the user clicks to edit a row in the grid, the model in the editor template is not getting populated. I verified that the dataItem is properly populated in the OnEdit event for the grid. But I always get an empty model in the popup form.
What am I missing?
Thanks.
J
@(Html.Telerik().Grid<EditAssetEntryViewModel>() .Name("AssetGrid") .Sortable() .Scrollable(scroll => scroll.Height(300)) .Pageable(paging => paging.Style(GridPagerStyles.Status).PageOnScroll(true)) .DataKeys(keys => keys.Add(o => o.AssetEntryID)) .Editable(e => e.Mode(GridEditMode.PopUp)) .Columns(columns => { columns.Bound(c => c.Description); columns.Bound(c => c.AssetClass).Width(200); columns.Bound(c => c.Shares).Width(80).Format("{0:n}").HtmlAttributes(new { style = "text-align:right;" }); columns.Bound(c => c.MarketValue).Width(80).Title("Mkt Value").Format("{0:c}").HtmlAttributes(new { style = "text-align:right;" }); columns.Bound(c => c.AdjustedMarketValue).Width(80).Format("{0:c}").HtmlAttributes(new { style = "text-align:right;" }); columns.Bound(c => c.AccruedIncome).Width(80).Title("Accrued Inc").Format("{0:c}").HtmlAttributes(new { style = "text-align:right;" }); columns.Bound(c => c.AdjustedAccruedIncome).Width(80).Format("{0:c}").HtmlAttributes(new { style = "text-align:right;" }); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); }).Width(38); columns.Bound(c => c.MarketPrice).Hidden(true); }) .DataBinding(dataBinding => dataBinding.Ajax() .Select("GetAssetEntries", "Statement", new { statementID = Model.StatementID }) .Update("UpdateAssetEntry", "Statement")) .ClientEvents(events => { events.OnEdit("onGridEdit"); }) .DetailView(detailView => detailView.ClientTemplate( "<div class='t-widget t-grid'>" + "<table cellspacing='0'>" + "<thead class='t-grid-header'>" + "<tr>" + "<th colspan='8' class='t-header'><#= Description #> <#= Description2 #></th>" + "</tr>" + "</thead>" + "<tr>" + "<td>Shares</td>" + "<td style='text-align:right;'><#= $.telerik.formatString('{0:n}', Shares) #></td>" + "<td><#= SecurityIDTypeDescription #></td>" + "<td><#= SecurityID #></td>" + "<td>Mkt Val</td>" + "<td class='t-last' style='text-align:right;'><#= $.telerik.formatString('{0:c}', MarketValue) #></td>" + "<td>Adj Mkt Val</td>" + "<td class='t-last' style='text-align:right;'><#= $.telerik.formatString('{0:c}', AdjustedMarketValue) #></td>" + "</tr>" + "<tr class='t-alt'>" + "<td>Mkt Price</td>" + "<td style='text-align:right;'><#= $.telerik.formatString('{0:c}', MarketPrice) #></td>" + "<td>Adj Mkt Price</td>" + "<td style='text-align:right;'><#= $.telerik.formatString('{0:c}', AdjustedMarketPrice) #></td>" + "<td>Acc Inc</td>" + "<td style='text-align:right;'><#= $.telerik.formatString('{0:c}', AccruedIncome) #></td>" + "<td>Adj Acc Inc</td>" + "<td class='t-last' style='text-align:right;'><#= $.telerik.formatString('{0:c}', AdjustedAccruedIncome) #></td>" + "</tr>" + "<tr>" + "<td>Cost</td>" + "<td style='text-align:right;'><#= $.telerik.formatString('{0:c}', Cost) #></td>" + "<td>Pct of Mkt</td>" + "<td><#= $.telerik.formatString('{0:p}', PercentOfMarket) #></td>" + "<td>Yld on Mkt</td>" + "<td><#= YieldOnMarket #></td>" + "<td>Asset Sector</td>" + "<td class='t-last'><#= AssetSector #></td>" + "</tr>" + "</table>" + "</div>") ))And here is the editor template:
@model EditAssetEntryViewModel<div style="padding: 20px; width: 500px; height: 250px;"> <div>@Html.HiddenFor(m => m.AssetEntryID)</div> <div>@Html.DisplayFor(m => m.MarketPrice)</div> <div>@Html.EditorFor(m => m.AdjustedMarketPrice)</div></div>I'm using this type of setup in several places and it works just fine. But here, for somereason, when the user clicks to edit a row in the grid, the model in the editor template is not getting populated. I verified that the dataItem is properly populated in the OnEdit event for the grid. But I always get an empty model in the popup form.
What am I missing?
Thanks.
J