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 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.

Guest UserPosted Aug 1, 2014, 10:09 PM