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.
1) Yes, The grid is inside the form tag BUT the GridModel is not the same that is defined on top of the ViewPage through the @model directive. Therefore the grid gets its datasource through the DataSourceUrl.
2) Yes there is an action attribute in my form tag. The action = "CreateJournal" which is called on FORM's POST method.
Is there a way I can get BOTH "igTransactions" (which is not part of my @model) as well as the Form's elements (@model elements) in the same single function. This way I would'nt have to make 2 different POST requests.