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

[Solved] GridEditMode.PopUp and dropdownlist values not sticking in the grid after edit

0 Answers 85 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.
Jim
Top achievements
Rank 1
Jim asked on 26 Sep 2011, 06:50 PM
I have a grid set to GridEditMode.PopUp that has a DropDown list of items.   When Adding a new item to the grid all values get displayed on the Grid except for the DropDown item.   The item does save to the database and when I rebind the data shows correctly.  The view is below:

 <% Html.Telerik().Grid<ContactModel>()
        .Name("ContactsGrid")  
        .DataKeys(keys => { keys.Add(c => c.Id); })
        .ClientEvents(events => events
                .OnError("RedirectOnError")
                .OnDataBound("Contacts_onDataBound")
                .OnRowDataBound("Contacts_onDataBound")
                .OnDataBinding("Contacts_onDataBound")
            )
        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image).ImageHtmlAttributes(new
            {style="margin-left:0"}))
        .Columns(columns =>
        {
            columns.Command(commands =>
            {
                commands.Delete().ButtonType(GridButtonType.Image);
                commands.Edit().ButtonType(GridButtonType.Image);
            })
                .Width(100);
            columns.Bound(c => c.Id);
            columns.Bound(c => c.Name).Width(120);
            columns.Bound(c => c.Title).Width(120);
            columns.Bound(c => c.Address1).Width(120);
            columns.Bound(c => c.Address2).Width(120);
            columns.Bound(c => c.City).Width(120);
            columns.Bound(c => c.State).Width(120);
            columns.Bound(c => c.Zip).Width(120);
            columns.Bound(c => c.PhoneOffice).Width(120);
            columns.Bound(c => c.PhoneCell).Width(120);
            columns.Bound(c => c.Fax).Width(120);
            columns.Bound(c => c.Email).Width(120);
            columns.Bound(c => c.ContactTypeId).ClientTemplate("<#= ContactType #>").Width(140).Title("Contact Type");
        })
        .DataBinding(dataBinding => dataBinding
            .Ajax()
            .Select("BindTempContacts", "Contacts")
            .Update("UpdateTempContact", "Contacts")
            .Delete("DeleteTempContact", "Contacts")
            .Insert("InsertTempContact", "Contacts")
         )
        .Editable(editing => editing.Mode(GridEditMode.PopUp))
        .Scrollable(scrolling => scrolling.Height(300))
        .Resizable(resizing => resizing.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
        .Sortable()
        .Filterable()
        .Pageable(paging =>
            paging.PageSize(50))
        .Selectable()
        .Render();
    %>
<% Html.Telerik().ScriptRegistrar().OnDocumentReady(() =>
    {
        %>
Tags
Grid
Asked by
Jim
Top achievements
Rank 1
Share this question
or