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

RenderControl() issues

2 Answers 90 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Guy Kolbis
Top achievements
Rank 1
Guy Kolbis asked on 08 Nov 2011, 05:17 PM
Hello guys,
I have a web control that holds RadDockLayout control as a property:
public class DockZonesContainer : Control
{
    private Telerik.Web.UI.RadDockLayout _layout;


In my control  I am trying to dynamically create DocZone and add it to the  RadDockLayout  control.
when I'm trying to load my page I get this error:

Page cannot be null. Please ensure that this operation is being performed in the context of an ASP.NET request.


on this source code:
public override void RenderControl(HtmlTextWriter writer)
{
    _layout.RenderControl(writer);
}


BTW
when I try to add a simple asp label. I got no errors.

Please advise.
Thanks


2 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 09 Nov 2011, 08:43 AM
Hi,

You need to add the RadDockLayout control to the control tree in order to be able to render it on the page.

protected override void CreateChildControls()
{
    base.CreateChildControls();
    Controls.Add(_layout);
}

Regards,
Lini
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Guy Kolbis
Top achievements
Rank 1
answered on 09 Nov 2011, 09:21 AM
Thanks, this it what I was missing.
Tags
General Discussions
Asked by
Guy Kolbis
Top achievements
Rank 1
Answers by
Lini
Telerik team
Guy Kolbis
Top achievements
Rank 1
Share this question
or