1
votes

I have created my MVC Kendo Grid with foreign key column i.e. columns.ForeignKey(). A Dropdown list appears, and when I selected an item from the list it neither marked the record for update nor it fired any ajax _Update on server.

All of the sudden I found that each grids with combobox has this problem. Don't know how to proceed to dig out it further. If this is a bug then where should I look in for existing bugs and their work around?

Following js files are there in my _Layout

> /2014.2.903/jquery.min.js
> /2014.2.903/kendo.all.min.js
> /2014.2.903/kendo.aspnetmvc.min.js
> /2014.2.903/kendo.modernizr.custom.js

Edit: Take care of the nullable model properties

This is an important note to take care of. In case your model consists of nullable properties of integer, floats or even byte types, the Kendo grid will not be able to update the model properties to their values on create or edit events. It's a known bug in Kendo grids having Kendo drop down lists in their editor template.

Solution: Search all the drop-downs in grid, retrieve values and set the model manually. Here 'Ordermaster' is the name of my grid. It''s working fine for GridEditMode.InLine.

function onSave(e) {
    // kendo nullable dropdown bug workaround
    $("#Ordermaster tbody [data-role=dropdownlist]").each(function () {
        var ddl = $(this).data("kendoDropDownList");
        if (ddl) {
            var v = ddl.value();
            var p = ddl.list.attr('id').replace('-list', ''); //<< TODO: optimize it
            if(p) e.model.set(p, v);
        }
    })
}
1
Can you post your grid code? You said all of the sudden, was it working before? You can log a ticket on Kendo support site to get official support. They also have an official forum.SBirthare

1 Answers

0
votes

Dropdown in grid works, we use it alot.

After selecting an item you must post back the changes to the server. Depedning on your edit mode (incell, inline) you have somewhere a button to save the changes. You also need to supply a create and update url where the data is send to. Also make sure that the HttpVerbs are correct. Kendo uses POST for all Actions by default (if i recall correctly even for Read they use POST).

Another issue can arise when your key is nullable. Then kendo interpretes the key as object. See here