ForeignKey dropdown column in PopUp editor

2 posts, 1 answers
  1. Mark
    Mark avatar
    1 posts
    Member since:
    Oct 2016

    Posted 30 Jun Link to this post

    I've set up a ForeignKey column with dropdown editor that works fine in GridEditMode.InLine but does not work at all in GridEditMode.PopUp

    <div>
        Season ID
    </div>
    <div>
        @(Html.Kendo().DropDownListFor(model => model.Season)
            .Name("SeasonId_#=Season_ID#")
            .DataValueField("SId")
            .DataTextField("Name")
            .Value("#=SId#")
            .Events(e => e.Change("onChange"))
            .BindTo((System.Collections.IEnumerable) ViewData["seasons"])
            .ToClientTemplate().ToHtmlString()
        )
        @Html.ValidationMessageFor(model => model.Season_ID)
    </div>

     

    It creates a functioning dropdown Inline, but in PopUp the input field does not render, but rather shows the HTML:

     

    Season ID
    <input id="SeasonId_#=Season_ID#" name="SeasonId_#=Season_ID#" type="text" value="#=SId#" /><script>    kendo.syncReady(function(){jQuery("#SeasonId_#=Season_ID#").kendoDropDownList({"change":onChange,"dataSource":[{"SId":5,"Name":"1971-1972"},{"SId":6,"Name":"1972-1973"},{"SId":7,"Name":"1973-1974"},{"SId":8,"Name":"1974-1975"},{"SId":9,"Name":"1975-1976"},{"SId":10,"Name":"1976-1977"},{"SId":11,"Name":"1977-1978"},{"SId":12,"Name":"1978-1979"},{"SId":13,"Name":"1979-1980"},{"SId":14,"Name":"1980-1981"}......

     

    Thanks.

  2. Answer
    Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    282 posts

    Posted 04 Jul Link to this post

    Hello Mark,

    I have updated one of our Foreign Key demos so you can compare it to your implementation. Please find it attached here. The foreign key should be decorated with the UIHint attribute as shown in this forum thread:

    http://www.telerik.com/forums/foreignkey-column-not-working-in-popup-edit-mode-doesn't-show-the-correct-item-selected#vSWvUKomIk2BKR1vr6kcNw 

    Please compare it with your implementation and let me know how you get on.

    Kind Regards,
    Alex Hajigeorgieva
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualisation (charts) and form elements.
Back to Top