hegendroffer hegendroffer - 6 months ago 19
CSS Question

Redirection after clicking submit button [HTML]

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

The code of the button is following:

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

@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