Skip to content
Loading
How to fire off an ActionLink (controller method) defined in a view.    
  •         
  • }    
  •     
  • class="modal fade" id="myModal13" role="dialog" display="none">    
  •     class="modal-dialog">    
  •         class="modal-content">    
  •             class="modal-body" style="padding:10px;">    
  •                 class="text-center">Any unsaved changes will not be processed if you cancel.       
  • Continue ?    
  •                 class="text-center">    
  •                     class="btn btn-info btn-yes13">Yes    
  •                     class="btn btn-default btn-no13">No    
  •                     
  •                 
  •             
  •         
  •     
  •     
  • @Scripts.Render("~/bundles/jqueryval")    
  • @Scripts.Render("~/bundles/jquery")    
  • @Scripts.Render("~/bundles/bootstrap")    
  • @Styles.Render("~/Content/css")    
  •     
  • "text/javascript">    
  •     $(document).ready(function () {    
  •         $(".cancelButton").click(function (e) {    
  •             // Trigger(show) the modal.    
  •             $("#myModal13").modal({    
  •                 backdrop: 'static',    
  •                 keyboard: false    
  •             });    
  •     
  •             // Prevent the ActionLink from going to the controller.    
  •             e.preventDefault();    
  •         });    
  •                
  •         $('.btn-yes13').click(function() {    
  •             // Hide the modal.    
  •             $('#myModal13').modal('hide');    
  •     
  •             // CONCERN: HOW TO NOW FIRE THE ActionLink TO GO TO THE CONTROLLER METHOD?    
  •     
  •             // Return.    
  •             return true;    
  •         });    
  •     
  •         $(".btn-no13").click(function () {    
  •             $("#myModal13").modal("hide");    
  •     
  •             return false;    
  •         });    
  •     
  •         // Remove the modal once it is closed.    
  •         $("#myModal13").on('hidden.bs.modal', function () {    
  •             $("#myModal13").remove();    
  •         });     
  •     });       
  •   
  • 5 Replies

    Know the answer? Post it — somebody with the same question will find it here.