@model IEnumerable<MvcApplication32.Models.UserInfo>   后台是集合类型了 ,传到前台是model了,用 IEnumerable<>转为集合类型

@model MvcApplication32.Models.UserInfo           强类型  

using MvcApplication32.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcApplication32.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        test1Entities db = new test1Entities();
        public ActionResult Index()
        {
          ViewData["data"]= db.UserInfo.ToList();
            return View();
        }

    }
}
View Code

相关文章:

  • 2022-01-28
  • 2021-12-31
  • 2022-02-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2021-08-26
  • 2021-10-23
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案