Pablo Tola
Top achievements
Rank 2
Pablo Tola
asked on 22 Jan 2008, 09:53 PM
How do I access templates (header, items) server side and modify them (add controls, change controls).
3 Answers, 1 is accepted
0
Hi Pablo,
You will have to use the FindControl method to reference any control inside any of the templates used in RadComboBox. You must make sure that you properly typecast the returned value as FindControl returns a reference to a Control class.
For details on the matter please refer to our Templates online example.
Kind regards,
Paul
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You will have to use the FindControl method to reference any control inside any of the templates used in RadComboBox. You must make sure that you properly typecast the returned value as FindControl returns a reference to a Control class.
For details on the matter please refer to our Templates online example.
Kind regards,
Paul
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Pablo Tola
Top achievements
Rank 2
answered on 23 Jan 2008, 02:14 PM
I saw that example before posting and tried a couple of things, without luck.
I need to do something like this:
Image image = (Image)RadComboBox1.HeaderTemplate.FindControl("imgMyImage");
and be able to set up the image source or any property of any type of control I have inside the HeaderTemplate... My problem is that I cannot get a reference to the Header or Items Templates.
Your example only shows how to access the items...
Please provide an example that shows how to get a reference of the templates and from then on I figure out things should be easier, but getting the reference is not as straight forward as I thought it would be...
Thanks.
I need to do something like this:
Image image = (Image)RadComboBox1.HeaderTemplate.FindControl("imgMyImage");
and be able to set up the image source or any property of any type of control I have inside the HeaderTemplate... My problem is that I cannot get a reference to the Header or Items Templates.
Your example only shows how to access the items...
Please provide an example that shows how to get a reference of the templates and from then on I figure out things should be easier, but getting the reference is not as straight forward as I thought it would be...
Thanks.
0
Hi Pablo Tola,
Unfortunately, there is no way in which you can access the Header/Item Template itself. Moreover, you can access only controls in the RadComboBox items, not in the header.
However, there is another way to simulate this behavior. For example, define a configurable Header Template (with add/hide/remove controls functionality, etc.) which is attached to the RadComboBox every time you need something to be modified in the Template (e.i. on every Page Load, Selected Index Changed, Button Click etc.)
Please, check out the attached demo.
I hope this informations is helpful.
Sincerely yours,
Simeon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Unfortunately, there is no way in which you can access the Header/Item Template itself. Moreover, you can access only controls in the RadComboBox items, not in the header.
However, there is another way to simulate this behavior. For example, define a configurable Header Template (with add/hide/remove controls functionality, etc.) which is attached to the RadComboBox every time you need something to be modified in the Template (e.i. on every Page Load, Selected Index Changed, Button Click etc.)
Please, check out the attached demo.
I hope this informations is helpful.
Sincerely yours,
Simeon
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center