asp.net mvc - Display a bootstrap alert in a modal after submitting a form -
i work asp.net mvc 4 , have issue bootstrap modal. have modal form containing 4 dropdownlist (in partial view), when submit form action check in database if reference exist.
i want display alert in modal if reference doesn't exist without leaving modal, please tell me if possible , how ?
this part of view
@using (html.beginform("afficherbobine", "home")) { <div class="modal fade" id="choisirbobine" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <div class="container-fluid"> <section class="row"> @html.partial("partialformbobine") </section> <section class="row"> </section> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">fermer</button> <button type="submit" class="btn btn-default">envoyer</button> </div> </div> </div> </div> }
and code of action :
[httppost] public actionresult afficherbobine(string annee, string semaine, string montage, string numero) { string arg = annee + semaine + montage + numero; idal dal = new dal(); //this code check if reference exist sortedlist arg_params = new sortedlist(); arg_params.add("num_bobine", arg); list<checkidentite> bobine = dal.retourneidentite(ref arg_params); if (bobine.count != 0) { return redirecttoaction("index", new { id = arg }); } else { //here code show alert ("wrong selection") } }
thanks attention
Comments
Post a Comment