How to use RadDatePicker inside a Custom Server Control using HttpTextWriter

4 posts, 0 answers
  1. Serban
    Serban avatar
    13 posts
    Member since:
    Oct 2010

    Posted 10 Jul 2011 Link to this post

    How do I use RadDatePicker inside a Custom Server Control using HttpTextWriter? It seems that the Telerik control hates the invocation of `RenderControl` outside of a UI.Page class. Its a shame as the standard .Net controls honor `RenderControl(writer)` perfectly - yet Telerik controls don't. I assume this has to do with the script manager and registering events.

    How can I get the flexibility of custom server controls whilst still being able to place Telerik controls inside them. User controls are not the answer.

    Any suggestions or implementations?

    Thankyou.
  2. Radoslav
    Admin
    Radoslav avatar
    1564 posts

    Posted 14 Jul 2011 Link to this post

    Hello Serban,

    You could create a composite control and add the RadDatePicker into its Controls collection in the CreateChildControls event. More information you could find on the following links:
    http://msdn.microsoft.com/en-us/library/3257x3ea.aspx
    http://www.codersource.net/asp-net/asp-net-advanced/creating-a-composite-control-in-asp-net.aspx
    http://stackoverflow.com/questions/1152032/what-is-composite-control-in-asp-nethow-we-create-composite-control
    http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c12725

    Additionally you could not just use HttpWriter to write the html of the RadControls to the page, because the RadControls are not simple controls. They have server side events, client side events, related scripts and other resources which will not be initialized or downloaded properly if you just render the control html to the page.

    I hope this helps.

    All the best,
    Radoslav
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eirik H
    Eirik H avatar
    36 posts
    Member since:
    Mar 2010

    Posted 23 Apr 2015 in reply to Radoslav Link to this post

    Radoslav said:
    Additionally you could not just use HttpWriter to write the html of the RadControls to the page, because the RadControls are not simple controls. They have server side events, client side events, related scripts and other resources which will not be initialized or 
     

    So if going the route of using a RadControl component (RadProgressBar in my case) in a component control and outputting to a HttpWriter is not possible, how would you do this, then?

  5. Eirik H
    Eirik H avatar
    36 posts
    Member since:
    Mar 2010

    Posted 23 Apr 2015 in reply to Eirik H Link to this post

    Ignore my last post. To anyone else coming here: Just don't use RenderControls, add the controls to the Controls collection.
Back to Top