Представление MVC: аргументы типа Html-помощник DisplayFor не может быть выведен из использования

Я пытаюсь использовать расширенный HTML Helper DisplayFor в этом представлении:

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcCms.Web.ViewModels.SubscriptionsViewModel>" %>

<% using (Html.BeginForm("TrainingSubscription", "Account", FormMethod.Post))
    { %>
 <%: Html.DisplayFor(m => m.Subscriptions) %>
 <input type="submit" value="Save" />
 <% } %>

со следующей ViewModel

namespace MvcCms.Web.ViewModels
{
    public class SubscriptionsViewModel
    {
        public string TrainingId { get; set; }
        public string Subject { get; set; }      
        public IEnumerable<SubscriptionViewModel> Subscriptions { get; set; }

        public SubscriptionsViewModel(string TrainingId, string Subject, IEnumerable<SubscriptionViewModel> Subscriptions)
        {
            this.TrainingId = TrainingId;
            this.Subject = Subject;
            this.Subscriptions = Subscriptions;
        }
    }

    public class SubscriptionViewModel
    {
        public string ContactId { get; set; }
        public string FullName { get; set; }
        public bool Subscribed { get; set; }

        public SubscriptionViewModel(string ContactId, string FullName, bool Subscribed)
        {
            this.ContactId = ContactId;
            this.FullName = FullName;
            this.Subscribed = Subscribed;
        }
    }
}

Это выдает мне эту ошибку

Аргументы типа для метода 'System.Web.Mvc.Html.DisplayExtensions.DisplayFor (System.Web.Mvc.HtmlHelper, System.Linq.Expressions.Expression>)' не может быть выведено из использования. Попробуйте явно указать аргументы типа

Я не могу понять, что не так. Обратите внимание, что я могу получить доступ к модели строго типизированным способом с появлением IntelliSense в представлении. Однако IntelliSense не появляется, когда я набираю лямбда-выражение.

6
задан Community 4 July 2016 в 12:14
поделиться