Reputation: 12294
i have created a area. after that i created the controller and then created the view as list. but the foreach statement is not able to recognize the Model. it is taking it as object but it should be an ienumarable? do i have to configure namespaces in the area somewhere?
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CentralBanking.Models.Currency>>" %>
<% foreach (var item in Model) { %>
// error object doesn't contains the public method for geteumerator
casting the Model will solve the problem but it is not i want to do. everything is working fine outside the area
Upvotes: 0
Views: 168
Reputation: 156708
You can see that the other parts of the Inherits
type are fully qualified. You must do the same with IEnumerable<>
, which belongs in the System.Collections namespace:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<System.Collections.IEnumerable<CentralBanking.Models.Currency>>" %>
Upvotes: 1