Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > problems using CompositeControl base class

Reply
Thread Tools

problems using CompositeControl base class

 
 
Steve Richter
Guest
Posts: n/a
 
      06-02-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Base class method Need base class value Karan Rajput Ruby 2 12-22-2010 04:47 PM
base class public type (non template and template base class) Hicham Mouline C++ 1 04-20-2009 03:28 PM
CompositeControl design time list problems when altering HTML (Objectdoes not support target type) Matt Winward ASP .Net 0 03-25-2008 02:48 PM
CompositeControl class failing to register postback Mantorok ASP .Net 2 06-22-2006 08:47 AM
Access of base class' private base class: qualification required, why Alf P. Steinbach C++ 6 09-03-2005 04:03 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57