Show dropdownlist value on update state

2 posts, 0 answers
  1. Xavier
    Xavier avatar
    28 posts
    Member since:
    Dec 2010

    Posted 26 Feb 2015 Link to this post


    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.

  2. Alexander Popov
    Alexander Popov avatar
    1445 posts

    Posted 02 Mar 2015 Link to this post

    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.

Back to Top