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

ItemSource Count is not same as Items.count

1 Answer 249 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sum sum
Top achievements
Rank 1
sum sum asked on 11 Nov 2009, 06:00 PM
Hi Guys,

Sometimes my gridview has ItemSource count = 10, but items.count = 0. Sometimes the counts are same. I remembered someone has posted some similar issue but I can't find it any more. Any answers? Also, when should I use grid.Rebind() function?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 12 Nov 2009, 07:46 AM
Hi sum sum,

There are cases where the Items.Count will not be the same as the total number of items of the data source. The reason for that is that Items.Count reflects the number of items that RadGridView is actually displaying - for example if you filter the grid the Items.Count will reflect the number of items that are passing the filter conditions.

In general we do not encourage the use of the Rebind method and if your data collection and items support change notifications you will never have to use the Rebind method. Rebind is usually used to refresh the grid when it is bound to a simple source collection, one that does not support change notifications, and that source collection is modified (for example an item is added). Rebind is one way to tell the grid to refresh itself and pickup the changes of the source collection.


All the best,
Milan
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.
Tags
GridView
Asked by
sum sum
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or