Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Number of rows in a datagrid

Reply
Thread Tools

Number of rows in a datagrid

 
 
PaulNaude
Guest
Posts: n/a
 
      10-12-2005
I discovered the hard way that the property "VisibleRowCount" of a datagrid
is ONLY that, the number of visible rows, NOT the number of populated rows in
the datagrid.

I need the number of populated rows (i.e. the number of records the user has
access to by scrolling to the end of the list).

I can't get it from the table since the datagrid is filtered.

Should I actually run a for next loop to count the rows, or even create a
datatable from the datagrid?

I am sure there must be a short cut!
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      10-12-2005
What about using the table's defaultView.Rows.Count?


"Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message
news:(E-Mail Removed)...
> nope either loop or use the dataset.tables.rows.count. if it is filtered
> like you say, you can still get the sum of the filtered row by passing in
> the filter to the dataset and a count expression. there's more help on
> this
> topic on MSDN and code snippets to do it as well.
>
> --
> Regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> The Microsoft Office Web Components Black Book with .NET
> Now Available @ www.lulu.com/owc
> Forth-coming VSTO.NET - Wrox/Wiley 2006
> -------------------------------------------------------
>
>
>
> "PaulNaude" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> I discovered the hard way that the property "VisibleRowCount" of a

> datagrid
>> is ONLY that, the number of visible rows, NOT the number of populated
>> rows

> in
>> the datagrid.
>>
>> I need the number of populated rows (i.e. the number of records the user

> has
>> access to by scrolling to the end of the list).
>>
>> I can't get it from the table since the datagrid is filtered.
>>
>> Should I actually run a for next loop to count the rows, or even create a
>> datatable from the datagrid?
>>
>> I am sure there must be a short cut!

>
>



 
Reply With Quote
 
 
 
 
PaulNaude
Guest
Posts: n/a
 
      10-14-2005
Unfortunaterly, Rows is not a member of defaultview. That should have been
ideal!

"Scott M." wrote:

> What about using the table's defaultView.Rows.Count?
>
>
> "Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message
> news:(E-Mail Removed)...
> > nope either loop or use the dataset.tables.rows.count. if it is filtered
> > like you say, you can still get the sum of the filtered row by passing in
> > the filter to the dataset and a count expression. there's more help on
> > this
> > topic on MSDN and code snippets to do it as well.
> >
> > --
> > Regards,
> > Alvin Bruney [MVP ASP.NET]
> >
> > [Shameless Author plug]
> > The Microsoft Office Web Components Black Book with .NET
> > Now Available @ www.lulu.com/owc
> > Forth-coming VSTO.NET - Wrox/Wiley 2006
> > -------------------------------------------------------
> >
> >
> >
> > "PaulNaude" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> I discovered the hard way that the property "VisibleRowCount" of a

> > datagrid
> >> is ONLY that, the number of visible rows, NOT the number of populated
> >> rows

> > in
> >> the datagrid.
> >>
> >> I need the number of populated rows (i.e. the number of records the user

> > has
> >> access to by scrolling to the end of the list).
> >>
> >> I can't get it from the table since the datagrid is filtered.
> >>
> >> Should I actually run a for next loop to count the rows, or even create a
> >> datatable from the datagrid?
> >>
> >> I am sure there must be a short cut!

> >
> >

>
>
>

 
Reply With Quote
 
PaulNaude
Guest
Posts: n/a
 
      10-14-2005
BUT, I found ...defaultview.count which does exaclty that!!! Thanks for the
idea!

"Scott M." wrote:

> What about using the table's defaultView.Rows.Count?
>
>
> "Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message
> news:(E-Mail Removed)...
> > nope either loop or use the dataset.tables.rows.count. if it is filtered
> > like you say, you can still get the sum of the filtered row by passing in
> > the filter to the dataset and a count expression. there's more help on
> > this
> > topic on MSDN and code snippets to do it as well.
> >
> > --
> > Regards,
> > Alvin Bruney [MVP ASP.NET]
> >
> > [Shameless Author plug]
> > The Microsoft Office Web Components Black Book with .NET
> > Now Available @ www.lulu.com/owc
> > Forth-coming VSTO.NET - Wrox/Wiley 2006
> > -------------------------------------------------------
> >
> >
> >
> > "PaulNaude" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> I discovered the hard way that the property "VisibleRowCount" of a

> > datagrid
> >> is ONLY that, the number of visible rows, NOT the number of populated
> >> rows

> > in
> >> the datagrid.
> >>
> >> I need the number of populated rows (i.e. the number of records the user

> > has
> >> access to by scrolling to the end of the list).
> >>
> >> I can't get it from the table since the datagrid is filtered.
> >>
> >> Should I actually run a for next loop to count the rows, or even create a
> >> datatable from the datagrid?
> >>
> >> I am sure there must be a short cut!

> >
> >

>
>
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      10-16-2005
HTH


"PaulNaude" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> BUT, I found ...defaultview.count which does exaclty that!!! Thanks for
> the
> idea!
>
> "Scott M." wrote:
>
>> What about using the table's defaultView.Rows.Count?
>>
>>
>> "Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message
>> news:(E-Mail Removed)...
>> > nope either loop or use the dataset.tables.rows.count. if it is
>> > filtered
>> > like you say, you can still get the sum of the filtered row by passing
>> > in
>> > the filter to the dataset and a count expression. there's more help on
>> > this
>> > topic on MSDN and code snippets to do it as well.
>> >
>> > --
>> > Regards,
>> > Alvin Bruney [MVP ASP.NET]
>> >
>> > [Shameless Author plug]
>> > The Microsoft Office Web Components Black Book with .NET
>> > Now Available @ www.lulu.com/owc
>> > Forth-coming VSTO.NET - Wrox/Wiley 2006
>> > -------------------------------------------------------
>> >
>> >
>> >
>> > "PaulNaude" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> >> I discovered the hard way that the property "VisibleRowCount" of a
>> > datagrid
>> >> is ONLY that, the number of visible rows, NOT the number of populated
>> >> rows
>> > in
>> >> the datagrid.
>> >>
>> >> I need the number of populated rows (i.e. the number of records the
>> >> user
>> > has
>> >> access to by scrolling to the end of the list).
>> >>
>> >> I can't get it from the table since the datagrid is filtered.
>> >>
>> >> Should I actually run a for next loop to count the rows, or even
>> >> create a
>> >> datatable from the datagrid?
>> >>
>> >> I am sure there must be a short cut!
>> >
>> >

>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rows the rows of a grid view? Jason James ASP .Net 0 08-10-2006 09:24 PM
dynamically add new rows and save data typed in these rows to a database Arjen Hoekstra ASP .Net 0 08-02-2005 12:15 PM
Problem with changing number of rows per page dynamically in datagrid lalitha1024 ASP .Net 1 07-19-2005 02:24 PM
convert rows to columns and columns to rows helpful sql ASP .Net 0 05-19-2005 06:03 PM
script for moving rows up and down and traverse thru rows of HTML table Subba Rao via DotNetMonster.com ASP .Net 0 03-19-2005 06:46 AM



Advertisments