Hi,
How to iterate through each row inside cell validating event. I am getting gridview.ItemSource inside cell validating event but not getting gridview.ItemSource.Count.I need to iterate through each row in that gridview.I am also not getting gridview.Columns or gridview.Rows
How can I loop through ?Please help.
Thanks,
Sulagna
5 Answers, 1 is accepted
If you want to validate the rows, you may use the RowValidating and RowValidated events of the RadGridView. Considering the way of getting the count of the items, you need to work with the Items collection of the grid, not its ItemsSource.
Maya
the Telerik team
Regards,
Sulagna
The recommended approach is to work directly with the data item, not the visual elements. So, if you want to update th values in a particular column, you may run through the Items collection and assign the desired value to the corresponding property:
foreach(Player player in this.playersGrid.Items){ player.Number = 42;}Maya
the Telerik team
foreach (GridViewRow row in radGridView1.Rows)
{
...
}
It is always recommended to work with the data items, not with the visual elements. Since the virtualization of RadGridView is turned on by default, all those visual elements will be recycled and recreated on scrolling. Thus using the rows of the grid will enable you to work only with the visual GridViewRow-s as only they are created.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>