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

[Solved] reference columns by name or index

2 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 19 Oct 2011, 04:18 PM
In a bit of a rush so don't have all day to surf !
But it's a simple question.
I can access my row such as
row.Name
row.Age
Any way to access as
row(2)
or
row("Age")
Thanks
Jim

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 19 Oct 2011, 04:24 PM
Hi Jim,

You need to work with the Items collection of the grid. For example:

foreach(Player player in this.playersGrid.Items)
{
     string name = player.Name;
}

You can reach each item by its index as well. For example:
Player sixthPlayer = this.playersGrid.Items[7] as Player;

 

Greetings,
Maya
the Telerik team

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

0
Jim
Top achievements
Rank 1
answered on 20 Oct 2011, 01:19 PM
Thanks
Jim
Tags
GridView
Asked by
Jim
Top achievements
Rank 1
Answers by
Maya
Telerik team
Jim
Top achievements
Rank 1
Share this question
or