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

How to Iterate through all controls in every itemtemplate?

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Xorcist
Top achievements
Rank 1
Xorcist asked on 21 Dec 2009, 03:44 PM
I'm having a hell of a time with this... thought it should be fairly straight foward, but I'm at a loss. Are there any good examples floating around out there that I can reference, a preliminary search of the forums, and a good look at the help files have yeilded very little in the way of an answer.

What I would like to acheive is a method for iterating through all the cells in my grid (which uses item templates) and determining when certain cells need adjusted text displayed. This includes replacement of string.Empty as well as shortening long strings and adding "..." to keep the grid formatted nicely. However I would rather not have to use findControl(), I would like to access each control via it's index within the itemtemplate. Is this at all possible?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Dec 2009, 04:05 PM
Hi Xorcist,

Have you looked at these resources:

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx

http://www.telerik.com/help/aspnet-ajax/grdconditionalformatting.html

You should use the RadGrid's ItemDataBound event, because at that time the cell content has been added, according to the corresponding datasource.

Let us know if you have further questions.

Best wishes,
Dimo
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
Grid
Asked by
Xorcist
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or