How to call an action method from view hyperlink or button. Action method have few input parameters.
I tried to call the view from hyperlink to fill the Model and populate the view respectively.
@Html.ActionLink("GetEmployee","GetEmpView","Employee",new {@empid= 1001, @fstname="Anshu",@lstname="Singh"}, null)
public ActionResult GetEmpView(int empid, string fstname, string lstname)
{
EmployeeModels emp1 = new EmployeeModels();
emp1.EmployeeID = empid;
emp1.FirstName = fstname;
emp1.LastName = lstname;
return View(emp1);
}
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Guest UserRank #259 · 9.8K reputationPosted Aug 1, 2014, 6:09 PM EDT
input type="button" title="Delete" value="D" onclick="location.href='@Url.Action("Delete", "movies", new { id = item.ID })'" />