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

add new record selected values are not displaying properly in kendo grid MVC incell mode.

15 Answers 4 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sandy
Top achievements
Rank 1
Iron
Veteran
sandy asked on 30 Nov 2020, 10:58 AM

Hi,

I have a kendo MVC grid with incell edit mode.

when i click  add new record and in new record row i have a autocomplete , cascading dropdown and normal dropdowns.

when i select values in first column and after move to second column then first column values are disappearing and again when i click on first column then values are showing in first column.

15 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 02 Dec 2020, 09:15 AM

Hello Sandy,

Please refer to our example for cascading dropdownlists in Grid with incell editing. If it does not help you resolve the problem, please send me a runnable project where I can observe the issue you are experiencing. I will debug it and provide further information on the matter.

Looking forward to your reply.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 02 Dec 2020, 10:30 AM

Hi, 

i have zipped my project and uploaded to google drive.

here is the link. Please find it.

https://drive.google.com/file/d/1Bn306JNKcV82WLW2xpN07HFD0VKgmG3I/view?usp=sharing

0
Martin
Telerik team
answered on 04 Dec 2020, 09:48 AM

Hello, Sandy,

Thank you for sharing the project.

I reviewed it and noticed that there are some differences in the configuration demonstrated in the example I shared and the demo about custom editors. For example, the AutoComplete and the DropDownLists are not bound to the Grid Model fields. Please see the ClientCategory.cshtml EditorTemplate from the demo I linked. I will need some time to make the necessary changes. I will get back to you when I have achieved the correct behavior.

Thank you for your patience.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Martin
Telerik team
answered on 09 Dec 2020, 11:06 AM

Hello, Sandy,

I reviewed the shared project. Below you will find the necessary changes so that the Custom Editors will be bound correctly. The changes are made for the AutoComplete Editor for the EmpName field. Note that those changes should be made for the rest of the Editors as well:

The field in the Model (EmpName) should be of type Employee instead of string.

[UIHint("EmployeeName")]
public Employee EmpName { get; set; }

In the Controller, an instance of the Employee class should be returned as well.

EmpName = new Employee() { EmpName = "a" + i.ToString(), EmpNumber = i },

In the Columns configuration, you will need to use a ClientTemplate to correctly display the corresponding text. Otherwise, [object Object] will be shown as value:

columns.Bound(p => p.EmpName).ClientTemplate("#=EmpName.EmpName#").Width(150).Filterable(ftb => ftb.Multi(true).Search(true)).EditorTemplateName("EmployeeName");

The above changes are also demonstrated in the examples I shared in my previous replies, so you could review them for reference.

I hope I was helpful. Let me know if you have any further questions.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 09 Dec 2020, 01:02 PM

Hi Martin,

Am unable to run your solution but i implemented the changes as you suggested.

am facing challegenges at add new record section.

could you pls share working code in kendo MVC project

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 10 Dec 2020, 11:14 AM

Here is am attached my project.

Please update your changes in my project.

https://drive.google.com/file/d/1EVO9VR2paa1GZef-wQVuYiIjogNSyjMR/view?usp=sharing

0
Martin
Telerik team
answered on 11 Dec 2020, 11:21 AM

Hello, Sandy,

Attached you will find the modified project, where I have also fixed the Add new record issue. In the DataSource Model, I had to add a default value for the EmpName field:

.Model(model =>
{
    model.Id(p => p.EmpNumber);
    model.Field(empVM => empVM.EmpName).DefaultValue(
                       new TimeControlReportEnhancements.Models.Employee {  EmpName = "EmpName 1" , EmpNumber= 1});
})

Please also check the changes in the AutoComplete EditorTemplate, as that is how all the custom editors should be bound.

@model TimeControlReportEnhancements.Models.Employee

@(Html.Kendo().AutoCompleteFor(m=>m)
            //.Name("Employees")
            .Placeholder("Select Employee...")
            .Filter("contains")
            .DataTextField("EmpName")
            .DataSource(source =>
                {
                    source.Read(read =>
                    {
                        read.Action("GetAllEmloyees", "Home");
                    })
                    .ServerFiltering(false);
                })
)

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 14 Dec 2020, 12:16 PM

Hi Martin,

thanks for your solution.

now your solution is working but i got another issue.

after clicking add new record and entered values for that new record only.

but when i click save changes in controller am getting all grid values to save instead of single record values.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 15 Dec 2020, 09:12 AM

Hi Marti,

Here is my updated project link.

Please find it.

if i modified a single record or added new single record and 

when i click save changes in view , in controller am getting all grid values to save instead of single record values.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 15 Dec 2020, 09:28 AM

Sorry i forgot the link. please find it.

https://drive.google.com/file/d/1Q3cL92m298AmTRXUQZYVhRmCc2skvS2v/view?usp=sharing

 

0
Martin
Telerik team
answered on 16 Dec 2020, 10:25 AM

Hello, Sandy,

Thank you for the project.

I have modified it so that the Create operation would work as expected. I have changed the CreateEmployeeDetails Action method as per our Batch Editing demo.

Let me know if there are any other questions on the matter. Attached you will find the modified example.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 16 Dec 2020, 11:56 AM

Hi Martin, 

still am getting same issue.

here am attched image. please find it.

0
Martin
Telerik team
answered on 18 Dec 2020, 10:48 AM

Hello, Sandy,

On this link you will find a small video demonstrating what is sent to the controller on my side. You can see that there is only one file and that is the updated one.

Could you please make sure that you are testing the last project I shared?

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sandy
Top achievements
Rank 1
Iron
Veteran
answered on 18 Dec 2020, 10:53 AM

Hi Martin,

Am tested the your previously attached project and  but still am getting multiple records. 

am attaching same image here

0
Accepted
Ivan Danchev
Telerik team
answered on 22 Dec 2020, 09:44 AM

Hello Sandy,

Martin is taking a few days off, but I ran the previously attached project and I see 1 record being added, after following the steps from the video Martin has recorded. What are you doing differently, to get 2 records in the CreateEmployeeDetails action? Are there any differences in the configuration of the Grid?

Regards,
Ivan Danchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
sandy
Top achievements
Rank 1
Iron
Veteran
Answers by
Martin
Telerik team
sandy
Top achievements
Rank 1
Iron
Veteran
Ivan Danchev
Telerik team
Share this question
or