numbering rows in datagrid

B

buran

Dear ASP.NET Users,

How can I get the total number of rows selected by the command text of the
datagrid (items in datagrid)? If I use the statement grdSP.Items.Count with
the datagrid grdSP with paging, it returns the page size (5,10..) not the
total results. How can I get the total no?
Thanks in advance,

Buran
 
C

Cowboy \(Gregory A. Beamer\)

Depends. If you are using a DataSet to bind, you can do the following:

int rowCount = DataSet1.Tables[0].Rows.Count;

or VB.NET

Dim rowCount as Integer = DataSet1.Tables(0).Rows.Count

If you are using a DataReader, you have to stream through the entire reader
to get the end result. For paging and sorting, DataReaders are not the best
option overall.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top