hegendroffer hegendroffer - 1 year ago 73
HTML Question

Redirection after clicing submitting button [HTML]

I am building my webapp using ASP.NET MVC applications.
I need to change the functionality of my submit button in my HTML code. Right now after clicking submit, the data is submitted and the page redirect into some particular one (I don't know why this one) but I want to stay at the same page. How can I achieve that? I have done research but all the answers didn't work for me.

The code of the buton is follwing:

<button type="submit" value="Dodaj" class="btn btn-success" data-toggle="modal" data-target="#infoModal">Dodaj</button>

Answer Source
@using (Html.BeginForm()) {
   <input name="Save" type="submit" value="Save" />

@using (Html.BeginForm("MyController", "MyAction")) {
   <input name="Save" type="submit" value="Save" />

You can set manually the redirection

The first one submits to the same action and same view is rendered


Inside the controller, there may be a code to redirect to some other action

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download