StoreManager - Index, Namespace=...Helpers

Aug 16, 2010 at 8:55 PM
Hi again I have another problem. Tutorial on page 49: HtmlHelper class (extension methods) and StoreManager Index. With code from tutorial I have compilation error: CS1579: foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator' in line: <% foreach (var item in Model) { %> When I commented out line: <%@ Import Namespace="MvcMusicStore.Helpers" %> I had compilation error: CS1061: 'System.Web.Mvc.HtmlHelper<System.Collections.Generic.IEnumerable<MvcMusicStore.Models.Album>>' does not contain a definition for 'Truncate' in line: <%: Html.Truncate(item.Artist.Name, 25) %> Without helper (extension method Truncate) code works.