Limited (partial) Binding of DataSet in DataGrid

D

Doug.Net

Hi,

Bit new to the datagrid -- any ideas on how I would display only
certain records from a dataset after or before binding in a grid? I
have an select statement on my database including an ORDER BY clause.
I want to display the 'top' x-number of records based on user input
from a dropdown list. Should be cool...but i can't find a method or
property for controlling the number of records displayed.

Thanks in advance and happy Independence Day!

Doug
 
J

James J. Foster

One solution would be to dynamically customize your SQL to include TOP X.
Then you are only bringing back the data you need. Another option might be
(since I haven't tried this specifically) to set paging on the datagrid, set
the pagesize (dgSearchResults.PageSize) to the number of records you want,
and then set current page index (dgSearchResults.CurrentPageIndex) to the
first page, and hiding the pager navigation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top