datagrid count

A

arno

Hello,

With a datagrid (asp.net 2), how do I do to have a query's total.
When I use GridView1.rows.count, I had the total for a page but not for all
pages.
(I don't wish to use a second query : "select count(*) from ...)"

Thanks by advance

arno
 
G

Grant Merwitz

Not certain about in 2.0

But you could either check in the datasource your binding to the drig

so if:
GridView1.DataSource = MyDataTable;

you could check
MyDataTable.Rows.Count

Alternately, the other way you could take it out of the datasource

int MyCount = ((DataTable)GridView1.DataSource).Rows.Count;
or
int MyCount = ((DataSet)GridView1.DataSource).Tables[0].Rows.Count;


HTH
 
A

arno

Grant Merwitz said:
Not certain about in 2.0

But you could either check in the datasource your binding to the drig

so if:
GridView1.DataSource = MyDataTable;

you could check
MyDataTable.Rows.Count

Alternately, the other way you could take it out of the datasource

int MyCount = ((DataTable)GridView1.DataSource).Rows.Count;
or
int MyCount = ((DataSet)GridView1.DataSource).Tables[0].Rows.Count;


HTH

arno said:
Hello,

With a datagrid (asp.net 2), how do I do to have a query's total.
When I use GridView1.rows.count, I had the total for a page but not for
all pages.
(I don't wish to use a second query : "select count(*) from ...)"

Thanks by advance

arno

It isn't ok in asp.net 2.

have you an another solution ?
 

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,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top