I am working on an MVC website, and am having a problem with passing data to my controller. My view has two partial views, and the one that is giving me a headache is below:
CableSummaryPartialView:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<MagnoliaWeb.DAO.CableSummary>>" %>
<p>
<%= Html.ActionLink("Create New", "Create") %>
</p>
<table>
<tr>
<th></th>
<th>
Id
</th>
<th>
CableId
</th>
<th>
System
</th>
</tr>
<% foreach (var item in ViewData["cablesummary"] as IEnumerable<MagnoliaWeb.DAO.CableSummary>) { %>
<tr>
<td>
<%= Html.ActionLink("Details", "Details", new { item.Id })%>
</td>
<td>
<%= Html.Encode(item.Id) %>
</td>
<td>
<%= Html.Encode(item.CableId) %>
</td>
<td>
<%= Html.Encode(item.System) %>
</td>
</tr>
<% } %>
</table>
My ActionResult in my controller looks like this:
public ActionResult Details(int cableId)
{
ViewData["cablesummary"] = repository.GetCableListSummary();
ViewData["cabledetails"] = repository.GetCableDetails(cableId);
ViewData["cableterminations"] = repository.GetCableTermination(cableId);
ViewData["cableroute"] = repository.GetCableRoutes(cableId);
return View("Index");
}
The problem appears to be that my View is passing my controller a null value. I have tried the code shown here, as well as trying to pass item as a whole and receiving it with a variable of the appropriate class.
Just so everyone knows, I have watched the value while debugging, and it is indeed passing a null...
Any ideas?
Thanks!
Ed
This post has been edited by erburrell: 12 January 2011 - 11:38 AM

New Topic/Question
Reply



MultiQuote




|