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

Model is null on Post to Controller

2 Answers 574 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Emmsa
Top achievements
Rank 2
Emmsa asked on 28 Apr 2017, 03:16 PM

Hello, 

I 'm have a view based on a ViewModel. This View Model has one Complex Property which is a collection.

public class ParentViewModel
    {
        public int Id { get; set; }

    public int Description  { get; set; }

        public List<SecurityListViewModel> secList { get; set; }
    }

2 Answers, 1 is accepted

Sort by
0
Emmsa
Top achievements
Rank 2
answered on 28 Apr 2017, 03:57 PM

My apologies! I have unintentionally published the post and now it doesn't allow me to edit it.

Here is my question again:

I have a view based on a ViewModel. This View Model has one complex property which is a collection. And I have a grid for CRUD operations of that collection.

When ever I submit this form the list is always null in the controller.

I found this stackoverflow post with a similar scenario but in .NET MVC:

http://stackoverflow.com/questions/14555137/submit-form-with-kendo-mvc-grid-and-other-elements

But I don't really like that solution.

Now with .NET Core, is there a better solution?

Thanks in advance

0
Konstantin Dikov
Telerik team
answered on 03 May 2017, 06:45 AM
Hi,

If you want to submit the changes within the Grid on submitting a Form you will have to use the suggested approach in the forum thread. The same approach is demonstrated in the following HowTo article:
Another solution would be to configure the DataSource of the Grid to use AJAX binding and handle the changes within the AJAX requests:
Hope this helps.


Regards,
Konstantin Dikov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Emmsa
Top achievements
Rank 2
Answers by
Emmsa
Top achievements
Rank 2
Konstantin Dikov
Telerik team
Share this question
or