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

    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.
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1444 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.

    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.

     
Back to Top