Dropdownlist in kendogrid cell is not working fine

1 Answer 73 Views
DropDownList Grid
Top achievements
Rank 1
Manuel asked on 13 Sep 2022, 05:46 AM


I have declared a column in a kendo grid as foreignkey,  data to be selected is set with as follows:

 columns.ForeignKey(mo => mo.CodKit, (System.Collections.IEnumerable)ViewBag.listKitMuestra, "idKit", "Descripcion").Title("Fabricante de Kit").Width(120);

where idKit is an integer and Descripcion is a string var.


The objects presented in kendoGrid have the CodKit field defined as int? and when I Create a row (inline edition used) when save button clicked, the value for CodKit is not sent in the objetct to controller.  If is an edition of a row with no value for this field and it´s setted to an option of the dropdownlist, kendoGrid acts as it was not changes in row an even not call to controller.  Ignores that column.

Only works if row has yet value  for this column when load items from database and you change the value selecting from dropdownlist another value, in this case is sent to controller in the objetct when update button is clicked.

I use incell dropdownlist with int values in several kendoGrids and no problem.  But this case with int? is not working correctly or i´m doing something wrong.


Best regards,.



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 15 Sep 2022, 08:14 AM

Hello Manuel,


Generally, for more complex Grid layouts and this kind of problems with ForeignKey columns, we highly suggest our users to use the Bound Template column alternative, as demonstrated here:

Here are the exact steps:

1. Create a custom Editor Template
2. Assign the UIHint() data attribute in your Model definition
3. Include a .Kendo().DropDownListFor(m=>m) in the template
4. One other crucial thing is to add the .DefaultValue for this dropdownlist field:
        .Model(model =>
            model.Id(p => p.ProductID);
            model.Field(p => p.ProductID).Editable(false);
            model.Field(p => p.Category).DefaultValue(
                ViewData["defaultCategory"] as Kendo.Mvc.Examples.Models.CategoryViewModel);

Also, I believe you will find the samples from this repository very helpful:

It contains many runnable projects with custom editing templates.


I hope this info will prove helpful to you.


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.

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