mvc pass value in controller from script



Consider the following example i am firing the script with a list value using for loop table data.

 <a href='#' class="gridEdit" onclick="javascript:return DeleteServiceOut('@Model.EmployeeInformationList[i].GEmployeeGenInfoID.ToString()');"></a>   

the function to pass values to controller from Javascript code in MVC

 <script>  
  function DeleteServiceOut(GEmployeeId) {  
     window.location = "/PMS/Payroll/ServiceOutAdd/ServiceOutDelete/" + GEmployeeId;  
     return false;  
   }  
 </script>  

in to the controller

 public ActionResult ServiceOutDelete(string id, ServiceOutModels model)  
     {  
       // id will contailn the value of parameter  
       // AS you want  
       return View("ServiceOutViewDetails", model);  
     }  


Popular posts from this blog

WPF Crystal Report Viewer Using SAP

mvc razor textboxfor change event change another textboxfor value

ASP.NET MVC razor SAP Crystal report