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

Show dropdownlist value on update state

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

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
(Html.Kendo().DropDownList()
    .Name("CatalogReference")
    .AutoBind(true)
    .OptionLabel("Select reference...")
    .DataTextField("Descripcio")
    .DataValueField("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); })
    .CascadeFrom("Tipus")
    .HtmlAttributes(new { id = Guid.NewGuid().ToString() })
)

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


Thanks for your responds.


Xavier.

1 Answer, 1 is accepted

Sort by
0
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.

Regards,
Alexander Popov
Telerik
 

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.

 
Tags
Grid
Asked by
Xavier
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or