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

Calculate viewd row number

8 Answers 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adiel
Top achievements
Rank 2
Adiel asked on 08 Jun 2009, 08:44 AM
Hi
I want to show GridView with paging.
I need to calculate page size by the actual viewed rows.
Is there is a way to know that?
I don't want scrolls and in every resolution there is different number of rows...
Thanks
Adiel

8 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Jun 2009, 08:54 AM
Hello Adiel,

You can use our extension methods to achieve this:

var count = RadGridView1.ChildrenOfType<GridViewRow>().Count;

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Adiel
Top achievements
Rank 2
answered on 08 Jun 2009, 08:59 AM
Hi
Great extensions!
Anyway In this way I had to try large amount of rows and then reduce page size.
I'm looking for way to calculate it from beginning. (base on Actual height?)
Any ideas?
Thanks
Adiel
0
Hristo
Telerik team
answered on 08 Jun 2009, 01:56 PM
Hello Adiel,

You cannot know the ActualHeight before the row is loaded. The only way to know the Height before row loaded is to set RowStyle on RadGridView and the set the Height to some value.

I hope this helps.

Regards,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Dec 2009, 04:12 PM
Is there something I don't understand here ?
the count reports me 4 rows but I have only 3 in the gridview !

If I'm right, is this the same thing as RadGridView.Items.Count ?
0
Rossen Hristov
Telerik team
answered on 18 Dec 2009, 04:18 PM
Hello Marc Rousel,

One of the them is the invisible GridViewNewRow which also inherits from GridViewRow.

All the best,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Dec 2009, 04:23 PM
Thank you for the information.
By the way my name is with 2 s Roussel

So based on this, when I have to iterate the rows, I should use .Count - 2 to take into account the newrow which I presume
is the last one !

0
Rossen Hristov
Telerik team
answered on 18 Dec 2009, 04:33 PM
Hi Marc Rousel,

It is better if you check whether the row is GridViewNewRow while iterating and if it is -- then do not do the thing you are doing.

As for the name, this is the way it is entered in your profile. You can edit your profile if you want to change your name.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marc Roussel
Top achievements
Rank 2
answered on 18 Dec 2009, 04:36 PM
Thanx.
Tags
GridView
Asked by
Adiel
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Adiel
Top achievements
Rank 2
Hristo
Telerik team
Marc Roussel
Top achievements
Rank 2
Rossen Hristov
Telerik team
Share this question
or