DisplayRowCount API not working

5 posts, 0 answers
  1. Ed
    Ed avatar
    11 posts
    Member since:
    Jun 2011

    Posted 29 Sep 2011 Link to this post

    Hello,

    When sort enable is set to true, the DisplayRowCount function returns zero even though I do see rows in the grid. Interestingly, when groupby is applied, it work and when from groupby mode go back to the normal mode, it stops working again. I am using Q2 2010. Is this a known issue? Has it been addressed in the later releases?

    As a workaround, I have resorted to using the accumulated height of rows in the grid. But this method does not work reliability as Height property for rows return zero.  

    Regards,
    Ed
  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 30 Sep 2011 Link to this post

    Hello Ed,

    In the latest version this is working fine as far as i can tell.

    In adition to the method you mentioned for getting the current visible row count you can use the following:
    var rowCount = radGridView1.TableElement.VisualRows.Where(r=>r is GridDataRowElement).Count();
    var rowCount2 = radGridView1.DisplayedRowCount(false);

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ed
    Ed avatar
    11 posts
    Member since:
    Jun 2011

    Posted 30 Sep 2011 Link to this post

    I am not clear about the following section of the code you have suggested: ".Where(r=>r is GridDataRowElement).Count();"

    My code is in c#. ".Where" does not appear to be a member of "VisualRows". I placed ".count" after "VisualRow" and it returns 1 and I can see 16 rows. When you say the latest version works, is this with sortenable set to true? Is there any history of this not working in the past?



  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 03 Oct 2011 Link to this post

    Hello Ed,

    Please add using System.Linq; if you are using .net 3.5 or if not, just change that to
    private int GetNrVisibleRows()
    {
            var nr = 0;
            foreach row in radGridView1.TableElement.VisualRows
                     if (row is GridDataRowElement)
                               nr++
            return nr;
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP


  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 04 Oct 2011 Link to this post

    Hi Ed,

    I hope this solution works for you. Our tests confirm what Emanuel said. We have not observed an issue related with DisplayedRowCount method in our latest release - Q2 2011 SP1.  I recommend trying this release. If the issue continues to appear, please send us your application and we will investigate it in detail. Thank you for your cooperation.

    Please note that you have to open a new support ticket in order to be able to attach your sample project.

    In case you have other questions, do not hesitate to ask.
     
    Best wishes,
    Jack
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
UI for WinForms is Visual Studio 2017 Ready