This is a migrated thread and some comments may be shown as answers.

DisplayRowCount API not working

4 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 29 Sep 2011, 06:01 PM
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

4 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 30 Sep 2011, 05:08 AM
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
0
Ed
Top achievements
Rank 1
answered on 30 Sep 2011, 03:39 PM
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?



0
Emanuel Varga
Top achievements
Rank 1
answered on 03 Oct 2011, 07:02 AM
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


0
Jack
Telerik team
answered on 04 Oct 2011, 09:08 AM
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 >>

Tags
GridView
Asked by
Ed
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Ed
Top achievements
Rank 1
Jack
Telerik team
Share this question
or