0

Is there any ASP view that has paging like listview and sorting like dataview?

I was trying to avoid the implementation of one of those two manually.

2 Answers 2

3

GridView automatically implements these two abilities. Make sure the AllowSorting and AllowPaging properties are set to true. If you're using a sqlDataSource or objectDataSource the functionality is automatically taken care for your.

GridView AllowPaging property description

GridView AllowSorting property description

By default the GridView displays 10 records at a time but you can change that by setting the PageSize property.

Sign up to request clarification or add additional context in comments.

2 Comments

Will AllowSorting and AllowPaging work with an object data source of type IEnumerable<ViewModel> ? Is it possible to choose which of the ViewModel properties I want to be sorted? eg: I have two properties and I want to have a button for each one of them so I can sort by them. I've seen examples with sql table sources but I'm not sure my source is valid for this, is it?
It works for ICollection, which is derived from IEnumerable, so my answer is probably not. Unfortunately I'm not knowledgeable enough to make that a definite answer.
1

If you're looking for something for ASP you're better off using a jQuery component. In ASP.NET, GridView does both, see this article: http://msdn.microsoft.com/en-us/library/aa479347.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.