views:

324

answers:

1

I am having the same problem as this post but the answer does not work.... No overload for method 'Pager' takes '4' arguments Am I using old MVCContrib or the answer is deprecated?

my code looks like this: in controller

 public ActionResult Index(int? clubid,int? page)
        {
            List<aspnet_Users> memberList = new List<aspnet_Users>();
            IEnumerable enumerable;
            if (!clubid.HasValue)
            {
                enumerable = aspnet_Users.Find(User.Identity.Name).Club != null ? aspnet_Users.FindAllByClubId(aspnet_Users.Find(User.Identity.Name).Club.Id) : aspnet_Users.FindAll();
            }
            else
            {
                if (clubid == 0)
                {
                    enumerable = aspnet_Users.FindAll();
                }
                else
                {
                    enumerable = aspnet_Users.FindAllByClubId(clubid.Value);
                }
            }
            ViewData["clubid"] = clubid;
            foreach (aspnet_Users member in enumerable)
            {
                memberList.Add(member);
            }
            return View(memberList.AsPagination(page ?? 1, 10));

        }

in view

 <h2>Index</h2>

 <% using (Html.BeginForm()) {
        ArrayList clubs=new ArrayList();
        clubs.Add(new Club(0, "Toate"));
        clubs.AddRange(Club.FindAll());

        %>

                 <%= Html.DropDownList("ClubId", new SelectList(clubs, "Id", "Name", (Model == null ? 0 : aspnet_Users.Find(Page.User.Identity.Name).Club != null ? aspnet_Users.Find(Page.User.Identity.Name).Club.Id : 0)))%>
                 <input type="submit" value="Filtreaza" />
  <% } %>

    <table>
        <tr>
            <th>Action</th>
            <th>
                UserName
            </th>
            <th>
                Club
            </th>

.....


         <%=Html.Encode(item.Male?"Male":"Female")%>
            </td>
             <td>
                <%=Html.Encode(item.BirthDay.HasValue?item.BirthDay.Value.ToString(ConfigurationManager.AppSettings["DateFormat"], CultureInfo.InvariantCulture):"")%>
            </td>

        </tr>

    <% }%>

    </table> <%= Html.Pager(Model)%>

if I filter the result changing the clubid with the dropdown the selected value is not passed to the next pages...

the next page link is Members/Index?page=2 and I want Members/Index?clubid=1&page=2

I have tried with <%= Html.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { categoryname = ViewData["clubid"] } )%> but i get compile errors

No overload for method 'Pager' takes '4' arguments

I have checked and I have the latest release og mvccontrib (1.0.0.916)

A: 

Not sure what exactly you are trying to do--perhaps you could post some code.

That said, the MvcContrib binaries available from CodePlex are pretty out of date. Specifically, there is a much improved grid and paging model. You should grab the latest from GitHub and build your own copy.

Wyatt Barnett
bogdanbrudiu