Hi,
In my view code I have written code for editing a record
@Html.ActionLink("Details", "Details", new { id = item.Tracking })
When loading the data I am able to see the fields mentioned in the script,
But In controller code
public ActionResult Edit(int SlNo)
{
var viewModel = new POViewModel();
viewModel.Order = PODb.orders.Single(x => x.Sl_No == SlNo);
viewModel.Order = (order)PODb.orders.Where(x => x.Sl_No == SlNo);
return View(viewModel);
}
Here In the above code I am getting the parameter value as null as it is throwing the below exception
"The parameters dictionary contains a null entry for parameter 'SlNo' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Edit(Int32)' in 'PurchaseOrder.Controllers.POController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
The parameters dictionary contains a null entry for parameter 'SlNo' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Edit(Int32)' in 'PurchaseOrder.Controllers.POController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters"
Could any one please help me how to rectify this one?
MayankPosted Dec 26, 2016, 7:32 AM
Dilip GuptaPosted Dec 23, 2016, 1:01 AM
Rajeesh MenothPosted Dec 15, 2016, 11:50 PM
Mahesh BodepudiPosted Dec 15, 2016, 11:36 PM
Dilip GuptaPosted Dec 15, 2016, 11:28 PM
Fabio Silva LimaPosted Dec 15, 2016, 11:54 AM