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

ForeignKey dropdown column in PopUp editor

1 Answer 434 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 30 Jun 2017, 05:26 PM

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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 04 Jul 2017, 03:17 PM
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.
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or