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

How to use RadDatePicker inside a Custom Server Control using HttpTextWriter

3 Answers 69 Views
Input
This is a migrated thread and some comments may be shown as answers.
Serban
Top achievements
Rank 1
Serban asked on 10 Jul 2011, 10:07 AM
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.

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 14 Jul 2011, 09:51 AM
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!

0
Eirik H
Top achievements
Rank 2
answered on 23 Apr 2015, 11:33 AM
[quote]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 
 

[/quote]

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?

0
Eirik H
Top achievements
Rank 2
answered on 23 Apr 2015, 12:11 PM
Ignore my last post. To anyone else coming here: Just don't use RenderControls, add the controls to the Controls collection.
Tags
Input
Asked by
Serban
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Eirik H
Top achievements
Rank 2
Share this question
or