This is a migrated thread and some comments may be shown as answers.

[Solved] Problem With grid and combobox

0 Answers 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shane
Top achievements
Rank 1
Shane asked on 29 Sep 2011, 06:05 PM
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()
                    );
Tags
Grid
Asked by
Shane
Top achievements
Rank 1
Share this question
or