I have used PartialView but it renders the whole view after success full ajax post
This is my view
my ul which i want to update
<ul id="ULdinnerlist">
@* my foreach loop*@
@foreach (var item in Model)
{
<li> Title : @Html.DisplayFor(modelItem => item.Title)<br />
EventDate : @Html.Encode(item.EventDate.ToShortDateString()+ " @ " + item.EventDate.ToShortTimeString())
<p>Description : @Html.DisplayFor(modelItem => item.Description)</p><br />
HostedBy : <b>@Html.DisplayFor(modelItem => item.HostedBy)</b> (@item.ContactPhone)<br />
</li>
}
</ul>
my ajax route link @ Ajax.RouteLink( ">>>"、new {page = Model.PageIndex + 1}、new AjaxOptions {UpdateTargetId = "ULdinnerlist"})
ON controller: my action for reindering
public ActionResult Index(int? Page)
{
int PageSize = 5;
IQueryable<Dinner> dines = from dine in db.Dinners orderby dine.EventDate select dine;
var paginatedDinners = new PagingList<Dinner>(dines, Page ?? 0, PageSize);
checking ajax post and rendering accordingly
if (Request.IsAjaxRequest())
{
return PartialView(paginatedDinners);
}
return View(paginatedDinners);
}
問題は、ページングを実行するとビュー全体がレンダリングされることです。ありがとう