Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Sending ForeignKey to Controller when editing a child grid
posted

Hi,

I have this Hierarchical grid which is calling MVC controller actions for DataSource & Update. On my controller action, I am calling web API to get data.I am able to update my parent grid using the transactions in controller. But when it come to child grid, I can see that "string path, string layout" are passed in Get. Now when I add or update any of the rows in child grid, I dont have reference of the foreign key when I read the transactions. How can we send the foreign key as part of child transaction to controller action. 

Thanks,

Ashwini

  • 29417
    Offline posted

    Hello Ashwini,  

    Thank you for posting in our forum. 

    The ForeignKey options specified for the child layout is not send as part of the transaction  log, however you could get the layoutKey option from the transaction log via which you can determine the layout for which on which the changes were made.

    Knowing the layout should provide enough information for updating the related data object associated with the child layout.

    You can refer to a similar example here:

    http://www.igniteui.com/hierarchical-grid/editing-dataset

     As you’ll see in the sample in the EditingSaveChanges action in the controller, the transactions can be deserialized using the LoadTransactions method and each transaction contains a “layoutKey” option, which is null for the parent grid and a string with the name of the layout for the child layout. 

    If the layout name does not provide enough information in order to update your data base you could define the grid model server side instead of in the razor view, similar to the example here:

    http://www.igniteui.com/hierarchical-grid/load-on-demand

    In this case you’ll be able to get the list of ColumnLayouts on the server side, loop through them to get the specific layout by its Key and get its ForeignKey property.

     Let me know if you have any questions or concerns regarding this.

    Best Regards,

    Maya Kirova

    Infragistics, Inc.

    http://es.infragistics.com/support