I am using ASP.Net MVC and IgniteUI. I have a form which contains form fields to be filled and this form will be posted through Form's POST method named "CreateJournal", I also have a grid which has an UpdateUrl named "SaveJournalDetail" which I have to call before Form submission so that the grid data is also saved on "SUBMIT" button. There is only one submit button and the UpdateUrl as well as Form's POST method have to be triggered through this same button.
The issue:
Scenatio1:When I fill the whole form and there is no error(Validation or any other) the Form's POST method is called therefore the "igtranscations" from grid are lost because "SaveJournalDetail" is never called.
Scenario2:When I fill the form with some errors(Validation or any other) which means the form fails to POST, the UpdateUrl is called. In this scenario I am able to get the "igtransactions" in "SaveJournalDetail" method but "CreateJournal" (Form's POST method) is never called resulting in form data not being posted.
Why is this happening? Scenario2 ensures that my syntax for Updating is fine because it works when POST fails. A short sample could also help.
Hello Imran,
Thank you for posting in our community.
In order to provide you more efficient help, I would like to clarify the following:
1) Did you place your grid within the form, which contains the other fields? Please note that this will ensure that on submit all form's data will be send to the server, including grid's changes.
2) Did you add "action" attribute to the form tag that specifies where to send the form-data when the form is submitted?
Looking forward to your response.
Sincerely,
Tsanna
Please tell me what to do . When I use the LoadTransactions<JournalDetail> in my Form's POST method ("CreateJournal"),I get null exception there. The grid is inside the form tag but the "igtransactions" form is not available in my "CreateJournal" method. What should I do . How do I get the igtransactions in the same method as my Form's POST method.
Also I checked in my browser, the UpdateUrl's ajax call was being cancelled by the browser thats why the Ajax Grid's updateUrl method was not able to run in my initial query. How can I get the "igtransaction" of grid(which is inside the form BUT not part of the same @model) as well as get all the form data too (the data which is part of my @model) in the same method without making ajax POST calls manually.
Could you send me an isolated sample project of this scenario? If I have something to test on my side it will be easier for me to see what's going on.
Hi,
I was really waiting for a solution to this problem for 4 days because I am stuck with this issue for 4 days. I am currently not at my office to provide you an isolated project of this scenario however I will try to provide you later.
If you keep my problem aside and just tell me, Is it possible to get the "igtransactions" in the same POST request as the form's POST method rather than a separate method for form's POST and a separate method for grid's Ajax Post. If it is possible can you show me how can I. I will try to provide you screenshot and a short sample of my scenario but if you are reading this then please try to answer my above mentioned query till I provide you an isolated project.
I'll be waiting for your response. Please look into this matter.
Thanks for your time.
After further research of this, it seems that it's not possible to get the grid transactions in the same request as the form's. However what you can do instead is to call 'saveChanges' API method of the grid inside of your button click event along with form.submit(). This will invoke an AJAX request to the UpdateUrl option and passes the serialized transaction log (a serialized JSON string) as part of the POST request. Here you can find more information about this method: https://www.igniteui.com/help/api/2014.1/ui.iggrid#methods:saveChanges
Please let me know if this works for you.
If you need further assistance, feel free to contact me.
Is this the case still today? Can we not over ride the save method to send other data in the form as well. Seems like a VERY big limitation.
Were you able to resolve the issue?
If I can provide further assistance, please let me know.
I'm afraid that the sample that you have sent me recently does not demonstrate the issue that you're describing. Please send me a sample that exactly reproduces your scenario. Otherwise I'm not able to test this behavior and determine the reason that causes the issue.
At the meantime you can try to set some time delay on the 'saveChanges' method via setTimeOut function. I assume that because of the asynchronous execution of both the post requests, it's possible that they overlap and hence one of them is cancelled. However this is only an assumption.
OKay, then this takes me back to my initial problem. The "savechanges" Ajax request is cancelled by the browser as soon as the MVC form's POST method is executed. Please check the solution which I attached in my previous post. There you can see that while the "savechanges" method is in the middle of its execution, its cancelled and form's POST method is called. How to fix this issue :|