S
Steve Richter
my composite control does not render correctly the 2nd time it is made
visible. When I change the base class from CompositeControl to
WebControl, the control works as it should.
public class RowPrompt2 : System.Web.UI.WebControls.WebControl,
INamingContainer
// public class RowPrompt2 :
System.Web.UI.WebControls.CompositeControl, INamingContainer
{
}
In CreateChildControls I clear controls, create a Panel control, then
create controls within the Panel.
protected override void CreateChildControls()
{
Controls.Clear();
...
}
when I switch to WebControl as the base class I have to comment out
the RecreateChildControls method:
// protected override void RecreateChildControls()
// {
// EnsureChildControls();
// }
In Render, I let the base class do the work:
protected override void Render(HtmlTextWriter InWriter)
{
base.Render(InWriter);
}
that is it. no other methods are overridden.
what is happening is, when the control is made visible the 2nd time,
the Panel which contains a series of Label, TextBox pairs followed by
two Buttons, is rendered with one label and a button with the text
value of one of the Labels.
I dont see what I could be doing wrong since when I change to the
WebControl base it renders correctly. Do I get a prize for finding a
bug in CompositeControl, or am I the one with the bug?
thanks,
-Steve
visible. When I change the base class from CompositeControl to
WebControl, the control works as it should.
public class RowPrompt2 : System.Web.UI.WebControls.WebControl,
INamingContainer
// public class RowPrompt2 :
System.Web.UI.WebControls.CompositeControl, INamingContainer
{
}
In CreateChildControls I clear controls, create a Panel control, then
create controls within the Panel.
protected override void CreateChildControls()
{
Controls.Clear();
...
}
when I switch to WebControl as the base class I have to comment out
the RecreateChildControls method:
// protected override void RecreateChildControls()
// {
// EnsureChildControls();
// }
In Render, I let the base class do the work:
protected override void Render(HtmlTextWriter InWriter)
{
base.Render(InWriter);
}
that is it. no other methods are overridden.
what is happening is, when the control is made visible the 2nd time,
the Panel which contains a series of Label, TextBox pairs followed by
two Buttons, is rendered with one label and a button with the text
value of one of the Labels.
I dont see what I could be doing wrong since when I change to the
WebControl base it renders correctly. Do I get a prize for finding a
bug in CompositeControl, or am I the one with the bug?
thanks,
-Steve