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

[Solved] URGENT: How to iterate through a Silverlight RadGrid

3 Answers 100 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.
Shiva
Top achievements
Rank 1
Shiva asked on 23 Feb 2011, 09:16 AM
Dear All,

We have an urgent requirement in our project of iterating through telerik silverlight radgrid but we are unable to do so. Can somebody please assist us on how can we acheive this. If this is not possible then an alternate way of acheving the same. It would be great if you could please include some code snippet as well in your response.

Problem Background
We need to iterate through RadGrid so that we can check each cell's value as we pass by. That is why we are looking for a mechanism where we can loop through the grid.

Let me know if you need more details around this.

Waiting for prompt response as always.

Cheers,
Shiva

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 23 Feb 2011, 09:18 AM
Hi Shiva,

You may iterate through the Items collection of the grid and check the values of each item's properties.

Greetings,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Shiva
Top achievements
Rank 1
answered on 23 Feb 2011, 10:05 AM
Dear Maya,

Thanks for your prompt response on this. I have reached upto here:

for (int i = 0; i < radGridCatDE.Items.Count; i++)
 {
                   
 }

Now I can access each item like radGridCatDE.Items[i]. When I do this, I get all columns but how do I access them because when I put "." after radGridCatDE.Items[i], the only options I get are Equals, GetHashCode, GetType and ToString.

How to access the individual column then?? Can you please share some code snippet?

Moreover, rather than access columns using an index, I would prefer referring them by their names.

Cheers,
Shiva
0
Maya
Telerik team
answered on 23 Feb 2011, 10:12 AM
Hello Shiva,

If you want to get access to the properties of each item, you will need to cast it to its corresponding type. Another possible approach for iterating through the item is by using the foreach statement. 
Generally, you do not need to get access to the columns in this case. However, in case you want to get them by the corresponding name, you may use the UniqueName property.
 

Kind regards,
Maya
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Shiva
Top achievements
Rank 1
Answers by
Maya
Telerik team
Shiva
Top achievements
Rank 1
Share this question
or