Ajax Paging is not working (mvc 3)

Aug 25, 2011 at 4:45 PM
Edited Aug 25, 2011 at 4:48 PM

Hi I am trying to follow the demo you have for ajax paging with microsoft/jquery. But I am not getting any ajax paging its  always giving me standard url paging.

heres how my code look like

 

controller {

      public ActionResult Index()
        {           
            int page = Request.QueryString["page"] != null ? Convert.ToInt32(Request.QueryString["page"]) : 1;

            if (Request.IsAjaxRequest())
            {
                return PartialView("__renderReviewItems", this.hotelDataService.GetClientReviews(this.currentDestination.DestinationID, page));
            }
            else
            {
                return View(this.hotelDataService.GetClientReviews(this.currentDestination.DestinationID, page));
            }
        }

}

 

 

view index.cshtml

 

<div >   
    @{Html.RenderPartial("__renderReviewItems",Model);}
</div>

 

 

view __renderReviewItems.cshtml

 

    <div class="pager">
        @Ajax.Pager(Model, new PagerOptions
   {
       PageIndexParameterName = "page",
       AlwaysShowFirstLastPageNumber = true,
       FirstPageText = "First",
       LastPageText = "Last",      
       CurrentPagerItemWrapperFormatString = "<span class=\"current\">{0}</span>",
       MorePagerItemWrapperFormatString = "<span class=\"more\">{0}</span>",
       NumericPagerItemCount = 5,
       PrevPageText = "<<",
       NextPageText = ">>",



   }, new AjaxOptions { UpdateTargetId = "dvReviewItems" })
    </div>

 

 

<div id="dvReviewItems" >

//looping through paged model and displaying tabular data

</div>

Please help!!

 

**NOTE : i have macrosoftajax , microsoftmvcajax and jquery included in the __layout.cshtml