I am following ScottGU tutorial : A Simple E-Commerce Storefront Application
http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx
I can't get data from ViewData in my strongly-typed view Categories.
I really don't know what I am doing wrong because I am following ScottGU tutorial.
I am using the latest MVC version 2 and ScottGU tutorial is based on the very first release.
Here is my aspx code :
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" CodeBehind="Categories.aspx.cs" Inherits="System.Web.Mvc.ViewPage<List<MyStore.Models.Category>>" %>
<h2>Browse Products</h2>
<ul class = "categorylisting">
<% foreach (var category in ViewData)
{ %>
<li>
<%=Html.ActionLink(category.CategoryName, new string { action = "List", category = category.CategoryName })%>
</li>
<% } %>
</ul>
Here is my Controller class :
[ControllerAction]
public ActionResult Categories()
{
List<Category> categories = northwind.GetCategories();
return View("Categories",categories);
}
Thanks for helping..