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

Edition in a grid inside a partial view

6 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Antonio
Top achievements
Rank 1
Antonio asked on 07 Aug 2018, 07:26 AM

Hi,

I have a grid inside a partial view that is bound to a local data (parent viewmodel is passed to the partial view).

The grid displays correctly the datas but when i try to edit a cell, i have this error: 'TypeError: Cannot read property 'Label' of undefined'.
Is there a way to solve this error?

Thanks;

6 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 09 Aug 2018, 10:37 AM
Hello Antonio,

Please make sure that IDs for the two grids are different. The id for a widget will be generated from the Name setting. Thus, ensure that the Name that is defined for the two grid is different and see how the behavior changes. 


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Antonio
Top achievements
Rank 1
answered on 09 Aug 2018, 12:35 PM

Hi Viktor,

Thanks for the reply.

In fact, i will only have one grid inside a partial view. I just wanted to show the different behaviour of the grid in edition.

I've attached a print screen of my code and the print screen of the page with only one grid.

In the index.cshtml i pass the model to the partial view. In the partial view, i may add or edit or delete rows and return the changes to the parent. The grid will be reused elsewhere.

Is-it something that can be done?

Thanks.

 

0
Preslav
Telerik team
answered on 14 Aug 2018, 10:15 AM
Hello Antonio,

I checked the provided screencasts and based on them, I am not sure why the editing is causing this error.

Having said that, I created a test project, and it seems the partial view is working okay on my side. Could you please check and modify the attached project so it clearly replicates the issue?

I look forward to hearing from you.


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Antonio
Top achievements
Rank 1
answered on 14 Aug 2018, 03:33 PM

Hi Preslav,

Thanks for the reply.

I've attached a print screen of the changes that replicates the issues.

Thanks.

Antonio

0
Preslav
Telerik team
answered on 17 Aug 2018, 03:21 PM
Hello Antonio,

Thank you for elaborating on the scenario. I was able to replicate the problem. I need additional time to understand what is causing this behavior. Having said that, I will update this forum as soon as I get anything relating the issue.

In the meantime, as a workaround, you could the approach from my demo and pass the whole model to the partial view.


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Boyan Dimitrov
Telerik team
answered on 22 Aug 2018, 09:51 AM
Hello,

After an investigation it seems that this problem is rather with ASP.NET Core Editor razor helper. Same behavior can be replicated with the same setup and using the Html.EditorFor from ASP.NET Core. 

public class HomePageModel
{
    public OrderViewModel Order { get; set; }
}


partial view: 

@using Kendo.Mvc.UI;
 
@model TelerikAspNetCoreApp28.Models.OrderViewModel
 
 
 
@(Html.EditorFor(m => m.ShipName))

We logged an issue in the aspnet repository and we are waiting for a response. 

In the meantime I would suggest either use the solution provided by my colleague Preslav Kozovski or change the editors from the Views/Shared/EditorTemplates folder to match the required data binding in order MVVM to work properly. For example the editor for string types should look like: 

@model object
 
@Html.Kendo().TextBox().Name("ShipName").HtmlAttributes(new { data_bind = "value:ShipName" })


Regards,
Boyan Dimitrov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Antonio
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Antonio
Top achievements
Rank 1
Preslav
Telerik team
Boyan Dimitrov
Telerik team
Share this question
or