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

[Solved] Select List with Telerik Grid inline editing q3210

0 Answers 109 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.
adeel zahid
Top achievements
Rank 1
adeel zahid asked on 29 Nov 2010, 01:38 PM
Hello Everyone,
i m using telerik controls (q3210 release) for my application. i tried inline editing with ajax binding and everything seems to work nicely. now, i want to use a select list when editing or adding a new record. this is the view code i have written

<%= Html.Telerik().Grid<UserManagement.Models.Designation>()
        .Name("Grid")
        .DataKeys(keys =>
        {
            keys.Add(p => p.ID);
        })
         .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Text).ImageHtmlAttributes(new { style = "margin-left:0" }))
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .Select("_SelectDesignation", "UM")
                .Insert("_InsertDesignation", "UM")
                .Update("_SaveDesignation", "UM")
                .Delete("_DeleteDesignation", "UM");
        })
        .Columns(columns =>
        {
            columns.Bound(p => p.Title).Width(210);
            columns.Bound(p => p.Description)
            .ClientTemplate(Html.DropDownList("Description",
            new SelectList((List<UserManagement.Models.BasicGroup>)ViewData["grp"], "GroupID", "GroupTitle", string.Empty), "Select some", new { disabled = "disabled" ,@value="<#=Description#>"}).ToHtmlString());   
                     
             
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Text);
                commands.Delete().ButtonType(GridButtonType.Text);
            }).Width(180).Title("Commands");
        })
        .Editable(editing => editing.Mode(GridEditMode.InLine))
        .Pageable()
        .Scrollable()
        .Sortable()       
%>
plz c in description field i have used client template and added a select list there and it is disabled through route value object. now i want to have it enabled as i click edit button on grid or "add new record" button on toolbar. i saw followed this link to write this code. i believe checkbox in example and select list in my code should exhibit the same behavior but its not the case. am i doing some thing wrong or there is some other way to incorporate drop down lists in the grid.
regards
Adeel 
Tags
Grid
Asked by
adeel zahid
Top achievements
Rank 1
Share this question
or