TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mahesh Bodepudi
NA
90
56.6k
Edit link passing null value when click on that link
Dec 15 2016 8:22 AM
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?
Reply
Answers (
6
)
ASP.NET Server Control
How to force a datetimepicker