本文介绍了传递到字典中的模型项是'pagedlist.pagedlist`1 [mvcfrontendlayout.models.home]'类型,但是这个字典需要一个类型为'mvcfrontendlayout.models.home'的模型项。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的模型



My Model

using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using PagedList;
using PagedList.Mvc;

namespace MVCFrontEndLayout.Models
{
    public class Home
    {
        MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["Mysqlcon"].ConnectionString);
        
        public List<Home> PartyNames { get; set; }
        public List<Home> BusinessPartysList { get; set; }
        public List<Home> WeddingPartys { get; public string Image_Path { get; set; }
        public string Venueimages { get; set; }

        public string City { get; set; }

        public string VenueName { get; set; }

        public List<Home> ShowallCategories { get; set; }

        public List<Home> PopularVenues { get; set; }
set; }

        public List<Home> VenueTypePartys { get; set; }

        public List<Home> Venues_Filter { get; set; }
        public int Id { get; set; }

        public List<string> Event_Name = new List<string>();

        public string Party_Event_Name { get; set; }

        public string Corparate_Event_Names { get; set; }

        public string BusinessPartys { get; set; }
        public string Wedding_Event_Names { get; set; }
        public string Venue_Type_Names { get; set; }

        public PagedList.IPagedList<Home> pagerlists { get; set; }
        public int PageSize { get; set; }
        
        //public class CoursesVM
        //{
        //    public PagedList<Home> pagerlists { get; set; }
        //}
        public List<Home> Selectalldata()
        {

            List<Home> Categorieslist = null;
            MySqlCommand cmd = new MySqlCommand("Select * from Popular_Categories", con);

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            DataSet Ds = new DataSet();
            da.Fill(Ds);
            Categorieslist = new List<Home>();
            for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
            {
                Home cobj = new Home();
                cobj.Image_Path = (Ds.Tables[0].Rows[i]["Image_Path"].ToString());

                Categorieslist.Add(cobj);
            }
            return Categorieslist;
        }

        public List<Home> DisplayVenues()
        {

            List<Home> Venuelist = null;
            MySqlCommand cmd = new MySqlCommand("Select v.Venue_Title,v.City,vimg.* from Venues_list v INNER JOIN venueimages vimg ON v.Venue_ID = vimg.venuesid   order by v.Venue_ID desc limit 3", con);

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            DataSet Ds = new DataSet();
            da.Fill(Ds);
            Venuelist = new List<Home>();
            for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
            {
                Home VenueImg = new Home();
                VenueImg.Venueimages = (Ds.Tables[0].Rows[i]["images"].ToString());
                VenueImg.VenueName = (Ds.Tables[0].Rows[i]["Venue_Title"].ToString());
                VenueImg.City = (Ds.Tables[0].Rows[i]["City"].ToString());
                Venuelist.Add(VenueImg);
            }
            return Venuelist;
        }

        public List<Home> PartyEvents()
        {
            List<Home> EventNames = null;
            MySqlCommand cmd = new MySqlCommand("select Party_Event_Name from Party_Events", con);
            con.Open();
            MySqlDataReader rdr = cmd.ExecuteReader();
            EventNames = new List<Home>();
            while (rdr.Read())
            {
                var Names = new Home();
                Names.Party_Event_Name = rdr["Party_Event_Name"].ToString();
                EventNames.Add(Names);
            }
            con.Close();
            return EventNames;
        }
        public List<Home> BusinessEvents()
        {
            List<Home> EventNames = null;
            MySqlCommand cmd = new MySqlCommand("select Corparate_Event_Names from Corparate_Types", con);
            con.Open();
            MySqlDataReader rdr = cmd.ExecuteReader();
            EventNames = new List<Home>();
            while (rdr.Read())
            {
                var Names = new Home();
                Names.Corparate_Event_Names = rdr["Corparate_Event_Names"].ToString();
                EventNames.Add(Names);
            }
            con.Close();
            return EventNames;
        }
        public List<Home> WeeddingEvents()
        {
            List<Home> EventNames = null;
            MySqlCommand cmd = new MySqlCommand("select Wedding_Event_Names from Wedding_Types", con);
            con.Open();
            MySqlDataReader rdr = cmd.ExecuteReader();
            EventNames = new List<Home>();
            while (rdr.Read())
            {
                var Names = new Home();
                Names.Wedding_Event_Names = rdr["Wedding_Event_Names"].ToString();
                EventNames.Add(Names);
            }
            con.Close();
            return EventNames;
        }
        public List<Home> VenueTypes()
        {
            List<Home> EventNames = null;
            MySqlCommand cmd = new MySqlCommand("select Venue_Type_Names from Venue_Types", con);
            con.Open();
            MySqlDataReader rdr = cmd.ExecuteReader();
            EventNames = new List<Home>();
            while (rdr.Read())
            {
                var Names = new Home();
                Names.Venue_Type_Names = rdr["Venue_Type_Names"].ToString();
                EventNames.Add(Names);
            }
            con.Close();
            return EventNames;
        }

        public List<Home> VenueFilterList()
        {
            List<Home> EventNames = null;
            MySqlCommand cmd = new MySqlCommand("select *  from venueimages order by venuesid desc limit 5 ", con);
            con.Open();
            MySqlDataReader rdr = cmd.ExecuteReader();
            EventNames = new List<Home>();
            while (rdr.Read())
            {
                var Names = new Home();
                Names.Venueimages = rdr["images"].ToString();
                EventNames.Add(Names);
            }
            con.Close();
            return EventNames;
        }
        //public class PagerViewModel
        //{
        //    public IPagedList pagerlist { get; set; }
        //}
        //public class Pagerlist
        //{
        //    public List<Home> HomePagers { get;set; }
        //    public PagedList.IPagedList<PagerViewModel> pagerlists { get; set; }
        //}
    }
}









控制器







Controler

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCFrontEndLayout.Models;
using PagedList;
using PagedList.Mvc;
using static MVCFrontEndLayout.Models.Home;
using AutoMapper;

namespace MVCFrontEndLayout.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index(Home obj)
        {

            Menubar(obj);
            return View(obj);
        }

        protected void Menubar(Home obj)
        {
            obj.ShowallCategories = obj.Selectalldata();
            obj.PopularVenues = obj.DisplayVenues();
            obj.ShowallCategories = obj.Selectalldata();
            obj.PopularVenues = obj.DisplayVenues();
            obj.PartyNames = obj.PartyEvents();
            obj.BusinessPartysList = obj.BusinessEvents();
            obj.WeddingPartys = obj.WeeddingEvents();
            obj.VenueTypePartys = obj.VenueTypes();
            
        }
        public ActionResult About()
        {
            ViewBag.Message = "Hi SS I am good.";

            return View();
        }

        public ActionResult Contact(Home obj)
        {
            ViewBag.Message = "Your contact page.";
            obj.ShowallCategories = obj.Selectalldata();
            obj.PopularVenues = obj.DisplayVenues();
            obj.PartyNames = obj.PartyEvents();
            obj.BusinessPartysList = obj.BusinessEvents();
            obj.WeddingPartys = obj.WeeddingEvents();
            obj.VenueTypePartys = obj.VenueTypes();
            return PartialView("Contact");
        }       

        public ActionResult List(Home obj, int page=1, int pagesize=3)
        {
            Menubar(obj);
            obj.Venues_Filter = obj.VenueFilterList();
            //int pageNumber = page ?? 1;
            //var model = new Pagerlist();
            //var model1 = Mapper.Map<IEnumerable<Home>, IEnumerable<Pagerlist>>(obj.Venues_Filter);
            //var model3  = model1.ToPagedList(pageNumber, pagesize);
            PagedList<Home> model = new PagedList<Home>(obj.Venues_Filter, page, pagesize);

            return View(model);
        }
    }
}







查看






View

@using PagedList;
@using PagedList.Mvc;

@model MVCFrontEndLayout.Models.Home

@*@model PagedList.IPagedList<MVCFrontEndLayout.Models.Home>*@

@{
    Layout = "~/Views/Shared/_LayoutPageForPages1.cshtml";
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Events</title>
    <link href="/Content/css/bootstrap.min.css" rel="stylesheet" />
    <!--<link href="css/bootstrap.css" rel="stylesheet" />
    -->
    <link href="/Content/css/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
    <link href="/Content/css/main.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/js/072b51f481.js"></script>

    <style>
/*.navbar-default {
    background-color:#212121;
    border-color: #212121;
}
.navbar-default .navbar-nav > li > a {
    color: #FFF;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
    color: #FFF;
    background-color: transparent;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
    color: #000;
    background-color: #e7e7e7;
}
*/
.navbar-default {
	background-color:#212121;
	border-color: #212121;
}
.navbar-default .navbar-nav > li > a {
	color: #FFF;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
	color: #FFF;
	background-color: transparent;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
	color: #000;
	background-color: #e7e7e7;
}
blockquote {
	padding: 10px 20px;
	margin: 0 0 20px;
	font-size: 17.5px;
}
/*.carousel {
    position: relative;
    height: 132px;
}*/

    </style>
</head>

<body>
    
    <section>
        <div class="container-fluid">
            <div class="row" style="margin-top: 15px;">
                <div class="col-md-1"></div>
                <div class="col-md-10">
@foreach (var item in Model.Venues_Filter)
{ 
                    <div class="boxinner1">
                        <div class="innerimg">
                            <img src='http://myeventvenues.elegantsoftsol.com/@Html.DisplayFor(modelItem => item.Venueimages)' width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                    }
                </div>
               
                <div class="col-md-1"></div>
            </div>
        </div>
    </section>
    <section>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-2" style="border:1px solid #ABABAB; padding:0px;">
                    <!--<div class="heading_adv_cntnt"><p>Advance Search</p></div>-->

                    <div class="panel">
                        <h2>One panel</h2>
                        <div class="panelcontent">
                            <ul style="margin-left: 21px;margin-top:7px;">
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Non Veg
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Drinks
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Veg
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Shrugs
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Jackets
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="panel">
                        <h2>Another panel</h2>
                        <div class="panelcontent">
                            <ul style="margin-left: 21px;margin-top:7px;">
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Non Veg
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Drinks
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Veg
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Shrugs
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Jackets
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="panelcollapsed">
                        <h2>Initially Collapsed</h2>
                        <div class="panelcontent">
                            <ul style="margin-left: 21px;margin-top:7px;">
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        < 300

                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        300 - 500
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        500 - 600
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        600 - 700
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        700 - 800
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        800 - 900
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        900 - 1000
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        1000 +
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="panel">
                        <h2>Another panel</h2>
                        <div class="panelcontent">
                            <ul style="margin-left: 21px;margin-top:7px;">
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Hyderabad
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Vizag
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Veg
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Shrugs
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <input type="checkbox" name="vehicle" value="Bike">
                                        Jackets
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                
                </div>
                <div class="col-md-6">
                    <div class="col-md-12">
                        <div class="heading_adv_cntntmiddle">
                            &nbsp;<a href="#">List</a>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;<a href="#">Map</a>
                            <div class="btn-group sortico">
                                <button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Sort By <span class="caret"></span> </button>
                            </div>
                        </div>
                    </div>
            @foreach (var item in Model.Venues_Filter)
                { 
                    <div class="col-md-12">
                        <div class="col-md-12 midboxlistadd" style="border:1px solid #ABABAB;">
                            <div class="imgboxleft">
                                <br />
                                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                                    <!-- Indicators -->
                                    @*<ol class="carousel-indicators">
                                        <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                                        <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                                        <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                                    </ol>*@

                                    <!-- Wrapper for slides -->
                                    <div class="carousel-inner" role="listbox">
                                        <div class="item active">
                                            <img src='http://myeventvenues.elegantsoftsol.com/@Html.DisplayFor(modelItem => item.Venueimages)' width="308" height="163" />
                                            <div class="carousel-caption"> </div>
                                        </div>
                                        <div class="item">
                                            <img src='http://myeventvenues.elegantsoftsol.com/@Html.DisplayFor(modelItem => item.Venueimages)' width="308" height="163" />
                                            <div class="carousel-caption"> </div>
                                        </div>
                                    </div>

                                    <!-- Controls -->
                                    @*<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a>*@
                                </div>
                                <br />

                                <!--<img src="images/venue-6.jpg" width="308" height="163" />-->
                            </div>
                            <div class="imgboxright">
                                <p style="font-size:15px;">Address: Koyambedu - Chennai  <button type="button" class="btn btn-info butmidre1">Add Favorites</button></p>
                                <p style="font-size:15px;">Price: <span class="strikcolor">Rs.900 / </span> <span class="nostrikcolor"> Rs.800 / Head</span>  <button type="button" class="btn btn-success butmidre2">Book Or Refer</button></p>
                                <p style="font-size:15px;">Capicty: 500 People  <button type="button" class="btn btn-primary butmidre3">To Earn Rewards</button></p>
                                <p style="font-size:15px;">Review: 50  </p>
                               
                            </div>
                            <div class="bodicons"> <i class="fa fa-wifi" aria-hidden="true" style="padding:0px 10px 0px 10px"> wifi </i> <i class="fa fa-car" aria-hidden="true" style="padding:0px 10px 0px 10px"> car </i> <i class="fa fa-male" aria-hidden="true" style="padding:0px 10px 0px 10px"> male </i> <i class="fa fa-female" aria-hidden="true" style="padding:0px 10px 0px 10px"> female </i> </div>
                        </div>

                    </div>

                }
                </div>
                <div class="col-md-2">
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                    
                </div>
                <div class="col-md-1"></div>
            </div>
        </div>
    </section>
    <section>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-3"></div>
                <div class="col-md-9">
                    <div class="btn-group" style="padding-top:10px;" role="group" aria-label="...">
                        @*<button type="button" class="btn btn-default">1</button>
                        <button type="button" class="btn btn-default">2</button>
                        <button type="button" class="btn btn-default">4</button>
                        <button type="button" class="btn btn-default">5</button>
                        <button type="button" class="btn btn-default">6</button>
                        <button type="button" class="btn btn-default">7</button>
                        <button type="button" class="btn btn-default">Last</button>*@

                        @Html.PagedListPager(Model.pagerlists,Page => Url.Action("List", new { Page, pageSize=Model.PageSize}))

                        Showing @Model.pagerlists.FirstItemOnPage to @Model.pagerlists.LastItemOnPage of @Model.pagerlists.TotalItemCount List
                    </div>
                </div>
            </div>
        </div>
    </section>
    <section>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-11">
                    <h2>Popular Vendors </h2>
                </div>
            </div>
        </div>
    </section>
    <section>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-1"></div>
                <div class="col-md-2">
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-2">
                    <div class="boxinner">
                        <div class="innerimg">
                            <img src="/Content/images/venue-1.jpg" width="100%" height="170" class="img-responsive" /><br />
                            <b class="hoteltopname"> <a href="#">Hotel Dew Drops Hotel</a></b>

                            <p class="hoteltopstar"><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span><span class="glyphicon glyphicon-star" aria-hidden="true"></span></p>
                            <h5 class="locitanblod"> <img src="/Content/images/venuebk_img/pointer.png" width="15" height="15"> Vijaynagar - Bengaluru </h5>
                            <span class="locwifiicons"> <i class="fa fa-wifi" aria-hidden="true"></i> <i class="fa fa-car" aria-hidden="true"></i> <i class="fa fa-male" aria-hidden="true"></i> <i class="fa fa-female" aria-hidden="true"></i></span>

                            <h6 class="locseatingcap"> Seating Capacity: 500 People </h6>
                        </div>
                    </div>
                </div>
                <div class="col-md-1"></div>
            </div>
        </div>
    </section>
    
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Choose Your City</h4>
                </div>
                <div class="modal-body">
                    <div class="pops">
                        <img src="/Content/images/banner-1.jpg" class="img-responsive" />
                        <div class="popb">
                            <b>India</b><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <b>India</b><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <b>India</b><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                            <a href="#">Ahmedabad</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Bangalore</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Chennai</a><br />
                            <br />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
        <div class="modal-dialog modal-sm">
            <div class="modal-content">
                <br />
                <form style="margin: 0px 5px 0px 5px;">
                    <div class="form-group">
                        <label for="exampleInputEmail1">Email address</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Password</label>
                        <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputFile">File input</label>
                        <input type="file" id="exampleInputFile">
                        <p class="help-block">Example block-level help text here.</p>
                    </div>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox">
                            Check me out
                        </label>
                    </div>
                </form>
                <!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <a href="#"><img src="images/fb.png" width="70" height="70" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#"><img src="images/fb.png" width="70" height="70" /></a><br />-->

                <div class="modal-footer">
                    <br />
                    <button type="button" class="btn btn-primary">Login</button>
                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Sign Up</button>
                </div>

            </div>

        </div>


    </div>


    <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <form style="margin: 10px 5px 10px 5px;">
                    <div class="form-group">
                        <label for="exampleInputEmail1">First Name</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="First Name">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">Last Name</label>
                        <input type="password" class="form-control" id="exampleInputEmail1" placeholder="Last Name">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1">Email address</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email address">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1">Mobile Number</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Mobile Number">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail1">Mobile Number</label>
                        <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Mobile Number">
                    </div>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox">
                            Check me out
                        </label>
                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>
            </div>
        </div>
    </div>

    <script src="/Scripts/js/jquery-2.1.1.min.js"></script>
    <script src="/Scripts/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/Scripts/js/utils.js"></script>
</body>
</html>











I am getting this error please solve it friends










I am getting this error please solve it friends


The model item passed into the dictionary is of type 'PagedList.PagedList`1[MVCFrontEndLayout.Models.Home]', but this dictionary requires a model item of type 'MVCFrontEndLayout.Models.Home'.





What I have tried:



The model item passed into the dictionary is of type ’PagedLi st.PagedList`1[MVCFrontEndLayout.Models.Home]’, but this dictionary requires a model item of type ’MVCFrontEndLayout.Models.Home’.



What I have tried:

The model item passed into the dictionary is of type 'PagedList.PagedList`1[MVCFrontEndLayout.Models.Home]', but this dictionary requires a model item of type 'MVCFrontEndLayout.Models.Home'.

推荐答案

@model MVCFrontEndLayout.Models.Home





You are giving it PagedList<Home>





You are giving it PagedList<Home>

PagedList<Home> model = new PagedList<Home>(obj.Venues_Filter, page, pagesize);
 
return View(model);





Why did you comment out the original, seemingly correct, model definition in your view?



Why did you comment out the original, seemingly correct, model definition in your view?


这篇关于传递到字典中的模型项是'pagedlist.pagedlist`1 [mvcfrontendlayout.models.home]'类型,但是这个字典需要一个类型为'mvcfrontendlayout.models.home'的模型项。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 23:09