Hi
I am (still) creating my first ASP.NET MVC 4 website and am using the igGrid on one of my pages.
I have the grid updating via the UpdateURL property - I can carry out CRUD operations on grid data without a hitch, I even get the IDs for new rows returned to grid rows.
I now need to have some other fields on the same page and I need to update them at the same time that I update the grid.
The fields are set up against properties in my model but I can't figure out how to access the model properties from the controller method that runs via UpdateURL.
Is this possible and, if so, can you give me a pointer as to how? As far as I can tell the controller method does not have access to the page's Model and neither does the GridModel.
It feels like I missing something obvious to the more experienced.
Thanks,
Graeme
I have had to settle for a two stage update process (shame I can't get it all into a transaction) by implementing the post back of the form on which the grid & other textboxes lie in addition to using the UpdateURL to save the grid data.
One Save button press will carry out a post back of the text box data and also action the UpdateURL controller method to save the grid data.
Untidy, but will have to do for now. There must be a better way, but I can't find it.
Hi Graeme,
I am updating this to let you know I am researching and working on a sample to help demonstrate a method to achieve this.
I will need a little more time to look into this. I will have another update for you by Wednesday.
I'm updating you to let you know I have found some information on this and am looking into implementing it into a sample to demonstrate this.
Here is a link to some of the information that I am looking into:
http://stackoverflow.com/questions/7763481/updating-view-with-model-changes-via-ajax-post-mvc3 * Please note this site is not owned or maintained by Infragistics.
I will have another update for you on Monday.
Please see the sample I have attached which demonstrates how you can consolidate all your transactions into one post.
I call $.post with the SaveAllTheChanges route, which takes the formatted data and updates the data from the grid and also provides information from your form inputs.
In the response, I send back "Success" equal to true, which the grid requires to finish updating on the client side through the _saveChangesSuccess method. I also return a "result" that the formSuccess method uses to set our textbox's value.
If you have any further questions or concerns with this, please let me know.
Hi, the example you provided here is almost perfect for me except for one thing: it does update the database on every single update to the grid.
1) How to catch all the new, deleted and modified rows and then send all that and all the other data out of the grid in one step?
2) How to do that with a igHierarchicalGrid with two levels (parent-child rows)?
3) How to do that using razor and C#?
I know I am asking too much but your answer will make many developers very happy :)
Thank you.