@html.AjaxPager not supporting in my project

May 17, 2012 at 3:25 PM

belowe functionallty not supporting, i have download ur demo project   

this is list of records, i want do paging for this

 

this is my view

  <div id="inner-right-mid">
                         
                            @foreach (var item in Model.FoodMasterDTO.Select((model, FoodSearchIndex) => new { FoodSearchIndex, model }))
                            {
                           
                                <div class="rpt-box">
                                    <div class="imgUser">
                                        <img src="@Url.Content("~/Content/images/RecipeImages/" + item.model.SlNo.ToString() + "/" + item.model.Image)" alt="img" width="62" height="60" border="0"  />
                                    </div>
                                    <div class="rightSec">
                                        <div class="straew">
                                            @Html.DisplayFor(modelItem => item.model.Item_Name))
                                        </div>
                                        <div class="rating">
                                            <a href="#">
                                                <img src="@Url.Content("~/Content/images/subpage/img-i.gif")" alt="img" width="15" height="15" border="0" /></a></div>
                                        <div class="rating">
                                            <a href="#" onclick="AddFav(@item.model.SlNo);">
                                                <img src="@Url.Content("~/Content/new-images/subpage/img-star.gif")" alt="img" width="15" height="15"
                                                    border="0" /></a>
                                        </div>
                                        <br class="clear" />
                                        <div class="sacLine">
                                            @Html.DisplayFor(modelItem => item.model.Energy_Kcal)) Cal (@Html.DisplayFor(modelItem => item.model.KcalInJoules))Kj)
                                            &nbsp|&nbsp Fat: 0.1 g | Carbs: @Html.DisplayFor(modelItem => item.model.Lipid_Tot))
                                            | Prot: @Html.DisplayFor(modelItem => item.model.Protien))
                                        </div>
                                        
                                        <div class="fleft">
                                            @Html.TextBoxFor(modelItem => item.model.ServeSize, new { style = "width:20px;height:15px;", maxlength = 10 })
                                            @*<div class="into">
                                            </div>*@
                                            @Html.DropDownList("quntity" + item.model.SlNo, ViewData["quntity" + item.model.SlNo] as SelectList, new { style = "width:50px;font-size: 10px; " })
                                        </div>
                                        <div class="fleft">
                                            @Html.DisplayFor(modelItem => item.model.Energy_Kcal)) Cal (@Html.DisplayFor(modelItem => item.model.KcalInJoules))Kj)</div>
                                        @*    @Html.ActionLink("Edit Me", "PlanThis", new { Slno = item.model.SlNo, @class = "linkPlan" })*@
                                        <a href="#" class="linkPlan" id="LikeThis" onclick ="plan(@item.model.SlNo)"  ></a>
                                        <a href="#" class="linkiate" id="AteThis" onclick="Recommend(@item.model.SlNo)"></a>
                                    </div>
                                </div>
                            }
                            <div id="page-wrap1">
                                <div class="pageholddiv">
                             
                                @Html.AjaxPager(Model,  new PagerOptions()
                           {
                               PageIndexParameterName = "id",

                               ShowDisabledPagerItems = false,
                               AlwaysShowFirstLastPageNumber = true
                           }, new AjaxOptions() { UpdateTargetId = "inner-right-mid" })
                               @* @Ajax.Pager(Model, new PagerOptions() { PageIndexParameterName = "id", ShowDisabledPagerItems = false, SeparatorHtml = "&nbsp;&nbsp;&nbsp;" }, new AjaxOptions { UpdateTargetId = "page-wrap1" })*@
                                    <ul>
                                       @* @{
                                           
                                            Pager pager = ViewBag.Pager;

                                            if (pager.HasPreviousPage)
                                            {<li>
                                                @Html.ActionLink("First", "FoodSearchIndex", new { page = pager.FirstPageIndex, @id = "First" })</li>
                                            <li>@Html.ActionLink("<", "FoodSearchIndex", new { page = pager.PreviousPageIndex })</li>
                                            }

                                            foreach (int page in ViewBag.Pager)
                                            {
                                            <li>@Html.ActionLink(page.ToString(), "FoodSearchIndex", new { page = page })</li>
                                            }

                                            if (pager.HasNextPage)
                                            {
                                            <li>@Html.ActionLink(">", "FoodSearchIndex", new { page = pager.NextPageIndex, @id = "Next" })</li>
                                            <li>@Html.ActionLink("Last", "FoodSearchIndex", new { page = pager.LastPageIndex })</li>
                                            }
                                        }*@
                                    </ul>
                                </div>
                            </div>
                        </div>

 

this is my model class

public class CareTakerNutrition : IPagedList
    {
    

        public IEnumerable<FoodMasterDTO> FoodMasterDTO { get; set; }

       
        public List<FoodMasterDTO> PagedOrders { get; set; }

        public List<FoodMasterDTO> LatestOrders { get; set; }

        public int CurrentPageIndex { get; set; }

        public int PageSize { get; set; }

        public int TotalItemCount { get; set; }
      

      
    }

below coding not supporting in my view

iam not getting @html.pager and @html.AjaxPager

    @Html.AjaxPager(Model,  new PagerOptions()
                           {
                               PageIndexParameterName = "id",

                               ShowDisabledPagerItems = false,
                               AlwaysShowFirstLastPageNumber = true
                           }, new AjaxOptions() { UpdateTargetId = "inner-right-mid" })

 

how add ur classs like IPagedList.cs,PagedList.cs,PagerBuilder.cs,PagerHelper.cs etc in my project where add these classes in  project for paging