Im working in a C# MVC .Net web project, and I used an ActionLink with a parameter, but I cant read it into the Controller.
Actionlink:
@model IEnumerable<FINAL.Models.Medico>
@foreach (var item in Model)
{
@Html.ActionLink("Eliminar", "DeleteMedico", new { id = item.NOMBRE.ToString() })
}
And heres how im trying to read it:
public ActionResult DeleteMedico(String elmedico)
{
//This WRITE is returning null. :(
System.Diagnostics.Debug.WriteLine("ELMEDICO:" + elmedico);
return View();
}
Im pretty new in MVC .NET development so I need your help.
Thanks.
Your parameter is improperly named based on your controller's expected arguments.
Either rename the parameter being passed:
Or rename the controller's argument to id: