This is awesome after all the messages I checked that there is still no final explanation (in my opinion) in which situation these topics should be used ...
I know for html.beginform, it will perform a postback, send data to the controller method and either redirect to another method or return the same view to the user.
I know that for ajax.beginform, you have to (fix me if I'm wrong) specify UpdateTargetID , where the resulting published data from the controller method will go into something like a partial view inside the div tag on the same page as the form. I know that after submitting the form, you cannot redirect another action method.
In both of these conditions, you can still enter another round of data for sending and processing through the controller.
So, if you don't need to redirect to a different action method, why don't you use ajax.beginform all the time?
The only thing I can imagine is that the html.BeginForm method is probably best for entering data over and over again, while the ajax.beginForm method will be used to display the result to the user depending on what information they enter into a form (almost as a one-off) deal. By the way, I know that I contradicted myself by using most of the time to use Ajax.BeginForm.
Can someone please give me a relatively simple explanation when to use each of these methods?
source share