Grid foreign key column doesn't show DDL neither Validation message

2 Answers 83 Views
DropDownList Grid
Top achievements
Rank 1
Cristian asked on 13 Sep 2022, 02:42 PM | edited on 13 Sep 2022, 02:47 PM


I'm facing this problem: in an MVC Grid, setted with InCell editing, I have a Foreign Key column. When I edit the FK cell the DDL is not showed.

I checked the documentation and for me it is all ok. 

Here some details:


            .Name("Grid_MCP_Detail_" +
            .ToolBar(toolbar =>
            .Columns(columns =>
                columns.Bound(c =>;
                columns.Command(command => command.Destroy().IconClass("k-icon k-i-delete").Text(" ")).Width(56).MinResizableWidth(56);
                columns.Bound(c => c.codiceInterno).Width(200).Sticky(true);
                columns.Group(g => g
                    .Title("A cura del personale Marketing o dei Service Specialist Supervisor")
                    .Columns(mkss =>
                        mkss.Bound(c => c.descrizione).Width(300);
                        mkss.ForeignKey(c => c.UMBase, ds => ds.Read(r => r.Action("unitaMisura", "MCPDetailGrid")), "idMSEHI", "descrMSEHL").Width(300);
                        //mkss.Bound(c => c.UMBase).Width(300);
                        mkss.Bound(c => c.gruppoMerci).Width(300);
                        mkss.Bound(c => c.lineaProdotto).Width(300);
                        mkss.Bound(c => c.codiceTipo).Width(300);
                        mkss.Bound(c => c.voceCE).Width(300);
                        mkss.Bound(c => c.codiceValore).Width(300);
                        mkss.Bound(c => c.gestLottiMatricola).Width(300);
                        mkss.Bound(c => c.codiceEDMA).Width(150);
                        mkss.Bound(c => c.nomeFornitore).Width(150);
                        mkss.Bound(c => c.codiceProdottoFornitore).Width(150);
                        mkss.Bound(c => c.codiceCategoriaFornitore).Width(150);
                        mkss.Bound(c => c.pezziConf).Width(150);
                        mkss.Bound(c => c.infiammabile).Width(150);
                        mkss.Bound(c => c.ghiaccioSecco).Width(150);
                        mkss.Bound(c => c.ggMinEntrata).Width(150);
                        mkss.Bound(c => c.ggMinUscita).Width(150);
                        mkss.Bound(c => c.UMVendita).Width(150);
                        mkss.Bound(c => c.rapportoUMBV).Width(150);
                        mkss.Bound(c => c.royalty).Width(150);
                columns.Group(g => g
                    .Title("A cura del Controllo di Gestione")
                    .Columns(ctgs =>
                        ctgs.Bound(c => c.costoAcquisto).Title("Costo acquisto").Width(150);
                        ctgs.Bound(c => c.valutaFatturazione).Title("Valuta di fatturazione").Width(150);
                        ctgs.Bound(c => c.codValuta).Title("Cod. Valuta").Width(150);
                        ctgs.Bound(c => c.prezzoMinimo).Title("Prezzo Minimo").Width(150);
                        ctgs.Bound(c => c.percProvvMinima).Title("% Provv minima").Width(150);
                        ctgs.Bound(c => c.prezzoSuggerito).Title("Prezzo Suggerito").Width(150);

                columns.Group(g => g
                    .Title("A cura del MKTG o dei SSS")
                    .Columns(mkss =>
                        mkss.Bound(c => c.costoAcquisto).Title("Costo acquisto").Width(150);
                        mkss.Bound(c => c.valutaFatturazione).Title("Valuta di fatturazione").Width(150);
                        mkss.Bound(c => c.codValuta).Title("Cod. Valuta").Width(150);
                        mkss.Bound(c => c.prezzoMinimo).Title("Prezzo Minimo").Width(150);
                        mkss.Bound(c => c.percProvvMinima).Title("% Provv minima").Width(150);
                        mkss.Bound(c => c.prezzoListino).Title("Prezzo Listino").Width(150);
                        mkss.Bound(c => c.percProvvMassima).Title("% Provv max").Width(150);

                columns.Group(g => g
                    .Title("A cura di AAT")
                    .Columns(aat =>
                        aat.Bound(c => c.codiceWindSat).Title("Cod. Winsat").Width(150);
                columns.Bound(c => c.idStato).Title("Stato").Width(150);
            .Editable(editable => {
            .Resizable(resizable => resizable.Columns(true))
            .DataSource(dataSource => dataSource
                .Events(events => events.Error("error_handler"))
                .Model(model => model.Id(p =>
                .Read(action => action.Action("Read", "MCPDetailGrid", new { idHeader = }))
                .Create(action => action.Action("Create", "MCPDetailGrid", new { idHeader = }))
                .Update(action => action.Action("Update", "MCPDetailGrid"))
                .Destroy(action => action.Action("Destroy", "MCPDetailGrid"))
            .NoRecords("Nessun prodotto presente")



 Html.Kendo().DropDownListFor(m => m)
        .BindTo((SelectList)ViewData[ViewData.TemplateInfo.GetFullHtmlFieldName("") + "_Data"])

I tried with/without  ValuePrimitive and with/without @model object



Where the data are used:

    public partial class MCP_Detail: IDisposable
        private MCPEntities MCPDB = new MCPEntities();

        public class MCP_DetailMetaData
            public int id { get; set; }

            public int idMCP { get; set; }
            [Required, MaxLength(10), DisplayName("Codice Interno")]
            public string codiceInterno { get; set; }

            [Required, MaxLength(40), DisplayName("Descrizione")]
            public string descrizione { get; set; }

            [Required, DisplayName("U.M. Base")]
            public string UMBase { get; set; }

            [Required, MaxLength(3), DisplayName("Gr. Merci")]


Where the data come from:

    public partial class MCP_Unita_Misura
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public MCP_Unita_Misura()
            this.MCP_Detail = new HashSet<MCP_Detail>();

        public string idMSEHI { get; set; }
        public string idMSEH3 { get; set; }
        public string idMSEH6 { get; set; }
        public string MSEHT { get; set; }
        public string descrMSEHL { get; set; }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<MCP_Detail> MCP_Detail { get; set; }



The FK exists also in the DB and in the Model        



Thanks in advance



2 Answers, 1 is accepted

Sort by
Telerik team
answered on 16 Sep 2022, 07:47 AM

Hi Cristian,


Thank you for writing to us.

Can you try resolving this issue by replacing the ForeignKey column with Bound.ClientTemplate approach and let me know about the result?


Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Top achievements
Rank 1
answered on 20 Sep 2022, 12:42 PM

Hi Eyup

Thanks for your reply

I solved the problem in 2 different ways.


[1] in the declaration of the FK column I use a view data instead of call a method:

mkss.ForeignKey(c => c.UMBase, (System.Collections.IEnumerable)ViewData["uniMisura"], "codice", "descrizione").Width(250);

in this way the default client template (GridForeignKey.cshtml) works fine


[2] if i what to get the FK data calling a method I have to use explicitly a client template like this:


@model MCP310.Models.MCP_Unita_Misura
    .DropDownListFor(m => m)
    .OptionLabel("Selezionare un valore....")
                .DataSource(source => source
                      .Transport(transport => transport
                        .Read(read =>
                            read.Action("unitaMisura", "MCPDetailGrid");//.Data("filterProducts");


For my case I choose solution [1] because I don't want to made unnecessary call to the database




Telerik team
commented on 23 Sep 2022, 10:05 AM

Hi Cristian,

I am glad that you have managed to find a suitable solution for your case and thank you for sharing it with our community!

DropDownList Grid
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Top achievements
Rank 1
Share this question