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

Grid CRUD method firing twice

2 Answers 547 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jean-Jacques
Top achievements
Rank 1
Jean-Jacques asked on 03 Aug 2015, 01:23 PM

Hello,

I managed to connect to the database by refering to the following article: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/ajax-editing
I am currently able to read, create, edit and delete table rows from my Azure SQL database.

Nevertheless, I still have a little problem dealing with that subject.

As soon as a modification is made (one row update for example) using that method, new rows are automatically created and they are based on
existing data before changes.
For example, I have a single row called "T1" in my datatable. After adding a second row called "Other", it automatically creates another
third row called "T1". As as result, I get 3 rows except of 2.

I have checked with some debugger and I have noticed that ​my creation method (called "FournisseursCreate" in the controller) is called twice once the "Update" button is clicked. But I don't handle KendoUI enough yet to point the reason out.

Have you ever heard about that ?​

I have attached the view and the controller I'm using.

 

Thank you for your help.

2 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 05 Aug 2015, 08:00 AM

Hello Jean-Jacques,

Although, I'm not exactly sure what is the cause for the described behavior judging from the provided information, I suspect it is due to incorrect ID field values. Please verify that existing records do have unique non-default values assign to their ID field. As you may know, the id field value is used to determine if the record is new or existing one. Thus, if the ID is the default one the record will be considered new and will be pushed via the Create method.

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jean-Jacques
Top achievements
Rank 1
answered on 05 Aug 2015, 09:41 AM

Hello,

 I believe you are right. I had some issues dealing with the way my items Ids were set. After correction, I am now able to interact normally with my database.

Thank you for pointing this out.

Tags
Grid
Asked by
Jean-Jacques
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Jean-Jacques
Top achievements
Rank 1
Share this question
or