This question is locked. New answers and comments are not allowed.
I am trying to get a grid to show a column as a combobox. Everything works fine except I can not figure out how to select the value in the combobox based on the data in the row.
here is a snippet. the bolded area is where I am setting the slected value. If I hard code it to an id it works fine, but I can not figure out how to get the value from the row.
@{ Html.Telerik().Grid<Ads.App.Zoom.Models.ExpenseCategory>()
.Name("Categories")
.HtmlAttributes(new { @class = "attachment-grid" })
.DataKeys(keys =>
{
keys.Add(o => o.Id);
})
.Columns(columns =>
{
columns.Bound(e => e.Id).Hidden(true).ReadOnly();
columns.Bound(e => e.AllocatorId);
columns.Bound(e => e.AllocatorId).Width(160).ClientTemplate(
Html.Telerik().ComboBox()
.Name("Test_Id_<#= Id #>")
.BindTo(new SelectList(NetProfitController.GetAllocators(), "Id", "AccountName", "<#=AllocatorId#>"))
.ClientEvents(d => d.OnChange("testOnChange"))
.ToHtmlString()
);
here is a snippet. the bolded area is where I am setting the slected value. If I hard code it to an id it works fine, but I can not figure out how to get the value from the row.
@{ Html.Telerik().Grid<Ads.App.Zoom.Models.ExpenseCategory>()
.Name("Categories")
.HtmlAttributes(new { @class = "attachment-grid" })
.DataKeys(keys =>
{
keys.Add(o => o.Id);
})
.Columns(columns =>
{
columns.Bound(e => e.Id).Hidden(true).ReadOnly();
columns.Bound(e => e.AllocatorId);
columns.Bound(e => e.AllocatorId).Width(160).ClientTemplate(
Html.Telerik().ComboBox()
.Name("Test_Id_<#= Id #>")
.BindTo(new SelectList(NetProfitController.GetAllocators(), "Id", "AccountName", "<#=AllocatorId#>"))
.ClientEvents(d => d.OnChange("testOnChange"))
.ToHtmlString()
);