harry code

harry code

  • NA
  • 124
  • 23k

unable to send data from view to controller

Jul 14 2018 12:00 PM
Hi,
I am doing an mvc application.
I am unable to send data from view to controller.
 
 View   code
@model IEnumerable<studentcourse.Models.course>
<h2>Index</h2>
<ol>
@foreach(var item in Model)
{
<li>@Html.ActionLink(item.coursename,"Details","Home",new {name=item.coursename})</li>
}
</ol>
 
 
 
controller code:
public ViewResult Details(string name)
{
return View(db.students.Where(x=>x.cousename==name.ToString()).ToList());
}
 
 
the parameter value for string name is showing null.
 
thanks in advance 
 

Answers (4)