Kendo grid duplicate records inserted

前提是你 提交于 2019-12-11 01:57:44

问题


I have a kendo grid in inline editing mode. When I press "Add new item" button, new row is added and set to the edit mode. By pressing the "Update" button multiple time, I'm able to insert duplicate records into database.

Is there a possibility to disable Update button after the first click?

Also row selection on kendo grid is lost after insert is performed. Is that normal behavior?


回答1:


This would happen if you don't return the ID of the newly inserted records. The Kendo DataSource would treat them as new unless you return the id values. More info is available in the documentation.




回答2:


The duplicate records will get entered if you don't return the entire record with the ID of the newly created record. The important point being to return the "entire record", not just the "ID".

public ContactBO CreateContact(ContactBO contact, int userid)
        {
            svc = new WCFService.VendorClient("BasicHttpBinding_IVendor", connectionString);
            contact.VendorReferenceID = userid;
            contact.ID = svc.SaveNewContact(contact, "external");
            return contact;
        }


来源:https://stackoverflow.com/questions/16726705/kendo-grid-duplicate-records-inserted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!