Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
6
Reply
Edit link passing null value when click on that link
Mahesh Bodepudi
Dec 15 2016 8:22 AM
269
Reply
Hi,
In my view code I have written code for editing a record
<td> @Html.ActionLink("Edit", "Edit","PO", new { id = item.Sl_No }) |
@Html.ActionLink("Details", "Details", new { id = item.Tracking }) </td>
<td>@item.Tracking</td>
<td>@item.Project_No</td>
<td>@item.Project_Phase</td>
<td>@item.Project_No_Description</td>
<td>@item.Requester</td>
<td>@item.Date_Requested</td>
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.
Parameter name: parameters
"
Could any one please help me how to rectify this one?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
6
)
Next Recommended Forum
ASP.NET Server Control
Error on save changes on entity side..