benim MVC 5 Uygulaması'nda hatayı alıyorum:MVC IPagedList
CS1061: 'IPagedList' 'TargetContact' ve hiçbir uzantı yöntemi için bir tanım içermiyor 'TargetContact' türünde ilk argüman kabul 'IPagedList' bulunamadı (bir kullanarak yönergesi veya bir derleme başvurusu eksik?)
burada cevapları gördüm ama yine de muhtemelen çözmek oldukça kolay :( halletmek yoktur.public ActionResult Index(string searchTargetContact = null, int page = 1)
{
var model =
from r in db.Outreach
orderby r.TargetContact descending
where (r.TargetContact.StartsWith(searchTargetContact) || searchTargetContact == null)
select new Models.OutreachSetListViewModel
{
TargetContact = r.TargetContact,
NextOutreachStep = r.NextOutreachStep,
GoalOfOutreach = r.GoalOfOutreach,
};
model.ToPagedList(page, 10);
return View(model);
namespace WebApplication11.Models
{
public class OutreachSetListViewModel
{
public string NextOutreachStep { get; set; }
public string TargetContact { get; set; }
public string GoalOfOutreach { get; set; }
}
}
@model IPagedList<OutreachSetListViewModel>
<table class="table" id="networkingList">
<tr>
<th>@Html.DisplayNameFor(model => model.TargetContact)</th>
<th>@Html.DisplayNameFor(model => model.NextOutreachStep)</th>
<th>@Html.DisplayNameFor(model => model.GoalOfOutreach)</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.TargetContact)</td>
<td>@Html.DisplayFor(modelItem => item.NextOutreachStep)</td>
<td>@Html.DisplayFor(modelItem => item.GoalOfOutreach)</td>
</tr>
}
Teşekkür ederiz! Şimdi özellikleri tanır, ancak aşağıdaki hatayı alıyorum '' Sözlüğe aktarılan model öğesi 'System.Data.Entity.Infrastructure.DbQuery'1 [WebApplication11.Models.OutreachSetListViewModel]' türündendir, ancak bu sözlük bir model öğesi gerektirir. 'PagedList.IPagedList'1 türü [WebApplication11.Models.OutreachSetListViewModel]'. ' – user2675973
Yanıtı güncelleştirildi. –
O kadardı !! Teşekkür ederim!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! – user2675973