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
Hello Graeme,
Please let me know if you still need help with this issue.
Hi Graeme,
Thanks for the update. You seem to have figured it out, but most of the code that is used within the pages of the sample should port over without needing to run the sample. HomeController and its Index view are the files where everything happens.
If you any further questions or concerns with this, please let me know.
Hi Michael
Thanks for this. I am having trouble getting your sample to run up - stuck with a problem with the reference to Newtonsoft.JSON. I can't add the reference because version 4.5 "is incompatible" with .NET framework 4.0...even though I have just such a reference in my own .NET 4.0 app.
I want to use batch updates so I will try putting my post behind a button rather than the editRowEndedHandler.
I will post later with my results.
Regards,
Please let me know if you need further assistance with this issue.
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.