The model item is of type CookMeIndexViewModel, but requires a model item of type IEnumerable

前端 未结 3 1011
名媛妹妹
名媛妹妹 2020-12-05 02:19

I am following along with the music store example to try learn ASP.NET MVC. I\'m creating a cookbook application.

I have created my viewmodel that looks like this:<

3条回答
  •  悲哀的现实
    2020-12-05 03:13

    in kendo ui Grid do :

    public class BookBean
        {
            [ScaffoldColumn(false)]
            public Int32 Id { set; get; }
    
            public String Title { set; get; }
    
            public String Author { set; get; }
    
            public String Publisher { set; get; }
    
            [UIHint("Integer")]
            public Int32 Price { set; get; }
    
            [UIHint("Integer")]
            public Int32 Instore { set; get; }
    
            [UIHint("Integer")]
            public Int32 GroupId { get; set; }
        }
    

    in Integer.ascx in Shared/EditorTemplate folder do :

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    
    <%: Html.Kendo().IntegerTextBoxFor(m => m)
          .HtmlAttributes(new { style = "width:100%" })
          .Min(int.MinValue)
          .Max(int.MaxValue)
    %>
    

提交回复
热议问题