How to add rad controls dynamically?

3 posts, 0 answers
  1. Saad
    Saad avatar
    82 posts
    Member since:
    Oct 2008

    Posted 02 Nov 2008 Link to this post

    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. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 02 Nov 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Saad
    Saad avatar
    82 posts
    Member since:
    Oct 2008

    Posted 02 Nov 2008 Link to this post

    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.
Back to Top