10 Answers, 1 is accepted
Creating a new record will pass an empty instance of your model to the template. When performing an update, an existing instance of your model must be passed to the template. To do this, you can use the following:
This will use the Id of the record that you are editing to look up the remainder of the missing properties for that instance.
By default, when a new record in the Kendo UI Grid is created, the ID is populated with the default value of the data type that is used for the field. For instance, if the ID is an integer, then the default value is 0. The record is sent to the server with the empty record. The ID has to be set on the server or by the database. It would not be expected a client-side grid to modify the ID.
As per editing functionality of the grid, the ID must be specified in the data source's model beforehand, as shown by Adam's code snippet:
This is mandatory for the editing of the grid to be working as expected. Also, it will be accessible in the custom template.
I am already doing this do you no what i am doing wrong here
My model is as follows
MyContext for upadting the poopup contents its here i need to no the id.
This is how i get all the activity lines for an acitivy i obv need to find also a way to pass the main id to the actitivy lines function.
I have noticed that the data item is passed to the template:
Which means that all of the fields of the model are accessible in the initial template. They can be accessed by using the "#= #" syntax:
Try the suggestion above and let me know in case the issue persists.
Based on the provided information, both here and in the official Support ticket, I assume that you would like firstly to pass the id of the master row to the template. And, secondly, to pass the id to the Read ActionMethod in the Controller, is that correct?
If so, then the additional parameter can be passed to the controller via the data source. For example:
And it can be retrieved as follows:
This approach has been depicted in our Hierarchy live demo which can be found here: