Gunjan Manan

Gunjan Manan

  • NA
  • 46
  • 8.3k

Not to reload a page on button click

Jul 5 2016 12:14 PM
Hi 
 
I have a view in mvc and I want that my page should not reload. I tried everything it is reloading again and again. May I know how can I stop it. I am attaching my code. 
this is the view
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">Uniphar Password</label>
<div class="col-sm-10">
@Html.EditorFor(model => model.password1, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Uniphar Pharmacy Password", @required = "required" } })
<a href="@Url.Action("Enable1", "Accounts", new { id = Model.companyId })" class="btn btn-default" id="btnSubmit">On</a>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">United Drug Account Number</label>
<div class="col-sm-10">
@Html.EditorFor(model => model.accountNumber2, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter United Drug Pharmacy Account Number" } })
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">United Drug Password</label>
<div class="col-sm-10">
@Html.EditorFor(model => model.password2, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter United Drug Pharmacy Password" } })
<a href="@Url.Action("Enable2", "Accounts", new { id = Model.companyId } )" class="btn btn-default" type="button">On</a>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<label class="col-sm-2 control-label">EuroDrug Account Number</label>
<div class="col-sm-10">
@Html.EditorFor(model => model.accountNumber4, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter EuroDrug Pharmacy Account Number" } })
</div>
</div>
When I am clicking
<a href="@Url.Action("Enable1", "Accounts", new { id = Model.companyId })" class="btn btn-default" id="btnSubmit">On</a>
 
it is reloading the page I want to restrict it. Any suggestions 
 

Answers (10)