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

How to add rad controls dynamically?

2 Answers 45 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Saad
Top achievements
Rank 1
Saad asked on 02 Nov 2008, 11:58 AM

I am trying the follwing code:

Page.Controls.Add(radcontrol);

But the method takes only System.Web.UI.Controls as a input parameter. So how can i add rad controls on my page at runtime?
Please help me!!!!!

2 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 02 Nov 2008, 03:29 PM
Hi Saadi,

Basically the code should work properly, as RadControls derive from System.Web.UI.Control.

Please, try running the simple page I just created.

I hope this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Saad
Top achievements
Rank 1
answered on 03 Nov 2008, 05:26 AM
Actually i`v created my own class for control named radPhotoViewer drived from class radcontrol. So, this isn`t allowing me to add add that control to page using Page.Controls.Add(radPhotoViewer). Not even in the radcontrols like radtoobar.Items.Add(radPhotoViewer).
Every method requires System.Web.UI.Control to pass as a parameter although i know all radcontrols are inherited from System.Web.UI.Control.
Tags
General Discussions
Asked by
Saad
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Saad
Top achievements
Rank 1
Share this question
or