I am getting this error when I try to post Via action link. I have a default map route.
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Rent_Approval(Kendo.Mvc.UI.DataSourceRequest, Int32)' in .....
Here is my action link
@Html.ActionLink("Send For Approval","Rent_Approval", "RentRequisition", new { id = "#=RentID#" }, new { @onclick = "OnIndexCall(this)" })
Here is my action method
public ActionResult Rent_Approval([DataSourceRequest] DataSourceRequest request, int id)
{
var record = db.RentRequisitions.FirstOrDefault(p => p.RentID == id);
try
{
if (record != null)
{
record.Status = Enum.GetName(typeof(OperationStatuses), 4);
db.Requisitions.Attach(record);
db.Entry(record).State = System.Data.Entity.EntityState.Modified;
db.SaveChanges();
}
var model = new List<RentRequisition> { record };
return RedirectToAction("Index");
}
Your syntax for the link doesn't look correct to me. Reference your view model to get the param values in the link's params
try...
@Html.ActionLink("Send For Approval","Rent_Approval", "RentRequisition", new { id = Model.RentID}, new { @onclick = "OnIndexCall(this)" })
Hope that helps