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

Show dropdownlist value on update state

1 Answer 39 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Xavier asked on 26 Feb 2015, 03:48 PM

We have a grid with a foreignkey column. This column has to call an edit template Dropdownlist with cascade property .

columns.ForeignKey(f => f.CatalogReference, (System.Collections.IEnumerable)ViewBag.Cataleg, "Reference",          "Descripcio").EditorTemplateName("CatalegReferenceByType");

@model object
    .OptionLabel("Select reference...")
    //.HtmlAttributes(new { data_skip = "true", data_bind = "defferedValue: object" })           //.BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])
    .DataSource(source => {
           source.Read(read => read.Action("PopulateReferences", "Catalog").Data("filterTypes"))
          .ServerFiltering(true); })
    .HtmlAttributes(new { id = Guid.NewGuid().ToString() })

It's possible show the value in dropdownlist when update state is selected.

Thanks for your responds.


1 Answer, 1 is accepted

Sort by
Alexander Popov
Telerik team
answered on 02 Mar 2015, 01:38 PM
Hi Xavier,

Basically, the ForeignKey helper is used to populate the columns.values array. This array is used to that the Grid can match the field values with the corresponding text that should be shown. In case the user selects an item that is not present in the columns.values array the cell will show up empty. As a workaround you can get and update the columns configuration, so that the array includes the selected item and update the Grid using the setOptions method.

Alexander Popov

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Asked by
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question