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
Form's POST method executes instead of UpdateUrl first


I am using IgniteUI and I am having an issue in igGrid's updating feature. I am using Asp.Net MVC 4.5.

I have a page which has a strongly model binded form which when filled will be inserted in a separate table, I also have a grid on the same page, this grid is not part of the same model and gets its data through a datasourceurl.

My issue: When I add new rows in the grid through the +AddNewRow button and at the same time I fill the whole form data too then instead of going to the UpdateUrl first on #submitBtn click, my Form's Post action method gets called and the "savechanges" of igGrid is not called resulting in lost "igtransactions".

I tested this behavior for many hours and came to realize that the UpdateUrl is called only when there is some kind of error on Form's post i.e unobtrusive validation error occurs on client side which results in the form not being able to post itself, only this time the updateUrl is reached with the correct number of igtransactions but then the form is not posted.

Why is this behavior happening? My click handler is something like this(ignore the syntax)>

$(#submitBtn).Click() { //do some work .. //call "savechanges" event of my grid }  //This same submit button is my Form's submit button too.

The updateUrl of my grid is also correct and works too in the scenario when the form post fails because of a validation error therefore there is no procedural error in my code. Also the same pattern of code(as far as i know) is written in my colleague's pc and there the code runs fine and the UpdateUrl is called first then the Form's Post method is executed after the UpdateUrl has finished working. I cant understand where did I go wrong, this behavior is so strange because I cannot understand why the same thing is working differently in my friend's computer.

In short the UpdateUrl is called only when the Form's Post method fails because of some validation logic whereas the UpdateUrl is never called if the Form is filled correctly and there are no validation error in the form, in this case the form's Post method gets called first instead of the "savechanges" method. Why is this happening? Please provide a short sample if you can.

Also is there a way to do the form post first and get the igtransaction in the Form's Post method so that we dont have to call "savechanges" on submit button click explicitly and direct the flow to a separate method instead of getting the igtransactions in the same single Form's POST action method.