Datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to limit the number of row displayed.
How can you display only the top 5 rows from the datagrid ?

Thanks,

Tanya
 
Tanya,

Edit your sql statement: select top 5 field1, field2 from tblFoo order by
field1

Andy
 
with or without paging?
If it's without then just change your SQL command to say "Select Top 5...."
(assuming you are using SQL).
Otherwise turn on the page size to 5 :}
 
I cannot do it on the sql side as it is an xml that I am loading in the
datagrid and sorting it by date. i don't want to have multiple page to be
displayed.
Just want to display the most recent 5 ?

Is it possible ?

Thanks,

Tanya
 
Probably not the most graceful solution but you can dump the XML into a
DataSet, then create a DataView of the DataSet containing the newest entries.
Or you could loop through the actual DataSet and remove all the rows except
the top 5.
 
Back
Top