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

Sending Parent Key to Controller

1 Answer 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Deamon
Top achievements
Rank 2
Deamon asked on 07 Nov 2014, 04:53 PM
I'm using MVC5.

I haven't been able to find an example of modifying parent / child or header / detail type of situation.

Currently I have a ViewModel that contains single data from a db record which is the parent or header info.  

The ViewModel also contains an IEnumerable of the child record type.

In the view I have elements of the header or parent data and a Grid for the child data.  How do I send the parent key when doing, say, a "create" of new data in the grid after save is pressed.

The grid is setup to use Ajax and updates are done in Batch.  

The issue is that I see how I can bind the columns to the child records, but how do I get the parent id sent when "save" is pressed?

Thanks in advance.



1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 11 Nov 2014, 04:27 PM
Hello Daemon,

Basically if the variable is coming from the MVC Model inside the view then you can do it like this:

.Update(up=>up.Action("UpdatePerson","Home", new { parentId = Model.TheID}))

If for some reason the above does not help or the variable should be resolved at run time then you can use the approach from here.

Kind Regards,
Petur Subev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Deamon
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Share this question
or