Number of rows in a datagrid

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Number of rows in a datagrid

    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!
    PaulNaude Guest

  2. Similar Questions and Discussions

    1. AdvancedDataGrid number of rows displayed
      This is probably really easy but I can't find a property for it. How does the AdvancedDataGrid determine the number of rows to display if no height...
    2. how to limit number of rows in a textarea
      :confused; I have a problem with limiting the textarea to a certain number of rows - after I specify the number of lines to 4 or any other number...
    3. DataGrid - Number of Displayed Rows
      Hi All Hopefully this is a simple one. I have an empty datagrid (which is editable for input data). By default, flex is drawing 7 or so empty...
    4. Results with Variable number of rows...help!
      Greetings, I've been playing around with this code a while it allows for a lot of flexability in terms of searching a database table. However...
    5. number of rows
      Hi all: Can anybody tell me how can I know how many rows, indexes and fields there are in every table on my database ? Thanks in advance. ...
  3. #2

    Default Re: Number of rows in a datagrid

    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 @ [url]www.lulu.com/owc[/url]
    Forth-coming VSTO.NET - Wrox/Wiley 2006
    -------------------------------------------------------



    "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
    news:95036EFD-46D8-4AC3-9A32-C1183EC8F3F6@microsoft.com...
    > 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!

    Alvin Bruney - ASP.NET MVP Guest

  4. #3

    Default Re: Number of rows in a datagrid

    What about using the table's defaultView.Rows.Count?


    "Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message
    news:uqECttzzFHA.2792@tk2msftngp13.phx.gbl...
    > 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 @ [url]www.lulu.com/owc[/url]
    > Forth-coming VSTO.NET - Wrox/Wiley 2006
    > -------------------------------------------------------
    >
    >
    >
    > "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
    > news:95036EFD-46D8-4AC3-9A32-C1183EC8F3F6@microsoft.com...
    >> 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!
    >
    >

    Scott M. Guest

  5. #4

    Default Re: Number of rows in a datagrid

    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:uqECttzzFHA.2792@tk2msftngp13.phx.gbl...
    > > 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 @ [url]www.lulu.com/owc[/url]
    > > Forth-coming VSTO.NET - Wrox/Wiley 2006
    > > -------------------------------------------------------
    > >
    > >
    > >
    > > "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
    > > news:95036EFD-46D8-4AC3-9A32-C1183EC8F3F6@microsoft.com...
    > >> 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!
    > >
    > >
    >
    >
    >
    PaulNaude Guest

  6. #5

    Default Re: Number of rows in a datagrid

    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:uqECttzzFHA.2792@tk2msftngp13.phx.gbl...
    > > 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 @ [url]www.lulu.com/owc[/url]
    > > Forth-coming VSTO.NET - Wrox/Wiley 2006
    > > -------------------------------------------------------
    > >
    > >
    > >
    > > "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
    > > news:95036EFD-46D8-4AC3-9A32-C1183EC8F3F6@microsoft.com...
    > >> 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!
    > >
    > >
    >
    >
    >
    PaulNaude Guest

  7. #6

    Default Re: Number of rows in a datagrid

    HTH :)


    "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
    news:7E0A7827-3506-484F-98E0-F06BAFFE6118@microsoft.com...
    > 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:uqECttzzFHA.2792@tk2msftngp13.phx.gbl...
    >> > 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 @ [url]www.lulu.com/owc[/url]
    >> > Forth-coming VSTO.NET - Wrox/Wiley 2006
    >> > -------------------------------------------------------
    >> >
    >> >
    >> >
    >> > "PaulNaude" <PaulNaude@discussions.microsoft.com> wrote in message
    >> > news:95036EFD-46D8-4AC3-9A32-C1183EC8F3F6@microsoft.com...
    >> >> 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!
    >> >
    >> >
    >>
    >>
    >>

    Scott M. Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139