e-on
e-on

Reputation: 1605

ajax paging with search filters in MVC3

I have a page that displays non-tabular search results (3 per page, as each one is quite detailed). This page also contains a form with a list of checkbox filters down the side - the default state of these is checked, as it shows all results. To remove certain options from the results, you uncheck them from the list and click to submit the form.

The controller then processes these filters and returns the new filtered search results.

What I want to do is add paging - ajax paging specifically. I just wondered how other people would go about this?

The paging functionality itself works (without ajax) - I can pass the pageSize and pageNumber and it return the correct results. However, I load the pagenumber into the form as a hiddenfield, and because posting the form is the trigger for paging, that has presented a problem. When I click the Next Page button, it uses jQuery to add a value to the pagenumber hidden field, and vice versa for Previous button. But if I'm on page 3 and I add some filters, the new list is posted back to the view, but it still tries to go to page 3, and if no page 3 exists, it throws an error.

It seems a convoluted solution to put the page number as a form field - there must be cleaner one out there. Has anyone ever used ajax paging in an MVC application that also required form-based filters?

Upvotes: 1

Views: 2770

Answers (1)

Persian.
Persian.

Reputation: 1035

This example is best source codes for asp.net MVC and JQuery ..

http://awesome.codeplex.com/

use this .

Upvotes: 3

Related Questions