CompositeControl descendants do not appear in ToolBox - bug?

Last post 02-16-2007 5:20 PM by RobK410. 17 replies.

Sort Posts:

  • CompositeControl descendants do not appear in ToolBox - bug?

    01-27-2006, 10:50 AM
    • Member
      80 point Member
    • KHenriksson
    • Member since 06-24-2005, 1:29 PM
    • Posts 16
    When I reference a control library Visual Studio does not enable me to drag CompositeControl descendants onto the WebPage as the control is hidden/disabled depending on the whether I show all controls.

    If I change the descendant to be of type WebControl and change the class name and recompile it appears fine. If I then change it back to descend from CompositeControl and keep the class name Visual Studio still keeps the icon and lets me drag it onto the web page.

    In all cases I can manually cobble together the tags to show it and visual studio will render the control, allow me to modify properties etc.

    This behavior seems very unusual to me especially since several of the new controls like Login, ChangePassword, SiteMapPath, and Wizard descend from CompositeControl. Is this expected behavior and if so, why? This seems like a bug to me.
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    01-27-2006, 12:14 PM
    • All-Star
      46,040 point All-Star
    • joteke
    • Member since 06-16-2002, 3:24 PM
    • Kyro, Finland
    • Posts 6,879
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    do you have small sample of such control for a repro?

    You are just inheriting from it, have you added or modified anything else?

    Thanks,

    Teemu Keiski
    Finland, EU
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    01-27-2006, 3:47 PM
    • Member
      80 point Member
    • KHenriksson
    • Member since 06-24-2005, 1:29 PM
    • Posts 16
    It is easy to reproduce:

    1. Create a new web site project.
    2. Right click in the solution explorer on the top-most node (Solution <solution-name>) and Add New Project.
    3. Select Class Library.
    4. Add Reference to the new class library and include System.Web.
    5. Modify Class1.cs to be as follows:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.WebControls;

    namespace ClassLibrary1
    {
        public class Class1 : WebControl
        {
        }

        public class Class2 : CompositeControl
        {
        }
    }
    6. Build the solution and switch over to Default.aspx in Design view. Note that Class1 is now available but Class2 is not.
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    01-30-2006, 3:07 PM
    • Member
      60 point Member
    • ibrahimm
    • Member since 11-04-2002, 8:05 PM
    • Posts 12
    • AspNetTeam

    This is a known bug in Whidbey when automatically creating such toolbox items derived from a base abstract class.  A workaround for now would be to explicitly add/pick these controls using the "Choose Toolbox Items" dialog.

    Thanks!    - Ibrahim

  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    08-17-2006, 9:34 AM
    • All-Star
      23,803 point All-Star
    • pkellner
    • Member since 11-12-2004, 10:42 AM
    • San Jose, California
    • Posts 3,567
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs
    I'm having trouble with the "Add/Pick" workaround.  My control shows as disabled.  When I right click on the toolbox, press choose items,  find my control (which is checked but shows as greyed out on the toolbox), press OK, nothing shows up on my default.aspx page and the control still shows as greyed out on the toolbox.

    Please explain this workaround in more detail or point me to the bug report with the details. 

    For me, composite controls sometimes show up, and other times they do not.  I don't understand what causes the apparent randomness.  This problem is very frustrating.
    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    08-23-2006, 12:58 PM
    • Member
      15 point Member
    • soslo
    • Member since 01-13-2006, 7:27 PM
    • Chico, CA
    • Posts 3

    I am having this same problem - some of my custom server controls will not appear in the toolbox, and some of those that do appear will not actually work (as in, they cannot be dragged onto an aspx page).

    I think this has to do with the type of base class that I am inheriting from. I'm extending some of the Telerik controls, and those that inherit from their controls that do not inherit directly from a stock asp.net control suffer this same problem.

    A workaround would be welcomed as this is a prety serious problem for me.

     

    http://www.netcast7.com
    Founder
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    08-23-2006, 1:17 PM
    • Member
      15 point Member
    • soslo
    • Member since 01-13-2006, 7:27 PM
    • Chico, CA
    • Posts 3

    I think I just solved this problem - try changing the class declaration from

     

       class foo : base { ... }

    to

       public class foo : base { ... }

     

    http://www.netcast7.com
    Founder
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    08-23-2006, 1:47 PM
    • All-Star
      23,803 point All-Star
    • pkellner
    • Member since 11-12-2004, 10:42 AM
    • San Jose, California
    • Posts 3,567
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs
    doesn't help me I don't think.  This is what my declaration looks like. I was hoping to hear from the Microsoft person ( ibrahimm ) who is on this thread also.  I'm about to post a blog entry with a very nice CAPTCHA control I wrote but I'm nervous I will get bombarded with people saying it doesn't work.  All Microsoft's controls seem to work, why not mine?

     [Designer(typeof(TemplateControlDesigner))]
        [ParseChildren(true)]
        [PersistChildren(false)]
        [DefaultProperty("Title")]
        [DefaultEvent("OnVerified")]
        [ToolboxBitmap(typeof(PeterKellner.Utils.CaptchaUltimateControl), "toolbaricon.bmp")]
        [ToolboxData("<{0}:CaptchaUltimateControl runat=server></{0}:CaptchaUltimateControl>")]
        public class CaptchaUltimateControl : CompositeControl
        {
        
    ibrahimm?  Help please.
    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    09-02-2006, 8:29 PM
    • Member
      19 point Member
    • ungrounded
    • Member since 01-09-2006, 5:45 PM
    • Posts 5

    pkellner:
    ibrahimm?  Help please.

    Any help yet?  Just running into this same issue myself now...looking for help...?

  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    10-10-2006, 6:54 AM
    • Member
      12 point Member
    • JGriffiths
    • Member since 10-12-2004, 9:12 AM
    • Posts 14

    I'm also stumped by this....

    I was following the example in:

    http://msdn2.microsoft.com/en-us/library/ms379565.aspx

     

  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    10-24-2006, 6:59 PM
    • Member
      145 point Member
    • echoSwe
    • Member since 11-09-2004, 8:58 AM
    • Posts 42

    I'm also experiencing this problem, and followed the tutorial JGriffiths linked to - could someone please help with this problem??

     

    // signature
    haf.se
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    02-13-2007, 5:36 AM
    • Member
      684 point Member
    • kimoy
    • Member since 02-13-2007, 10:24 AM
    • Posts 154

    hello, has anyone found a solution to this problem?

    i tried creating a custom composite control but instead of inheriting it from 'CompositeControl' class, i used 'WebControl' class and 'INamingContainer' interface. after building the code, my custom composite control started to appear in the VS2005 SP1 toolbox.
     

    public class MyCompositeControl : WebControl, INamingContainer
    {

    // some code here...

    }
     

  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    02-13-2007, 6:20 AM
    • Member
      145 point Member
    • echoSwe
    • Member since 11-09-2004, 8:58 AM
    • Posts 42
    I think SP1 fixed a lot of these issues. If I have the project with web controls in it, in the solution, they often appear like they should. However, if I just reference the dll file, the problem is still there, and I haven't found a way around that.
    // signature
    haf.se
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    02-13-2007, 10:33 PM
    • Member
      684 point Member
    • kimoy
    • Member since 02-13-2007, 10:24 AM
    • Posts 154
    i'm not really sure what you mean by SP1 has fixed a lot of these issues coz i have SP1 installed but the problem still persists. so, in building my custom composite control i didn't inherit from CompositeControl class but instead inherited from 'WebControls' and 'INamingContainer'. By doing this, my custom composite control appears in the toolbox.
  • Re: CompositeControl descendants do not appear in ToolBox - bug?

    02-14-2007, 3:02 AM
    • Member
      145 point Member
    • echoSwe
    • Member since 11-09-2004, 8:58 AM
    • Posts 42

    I mean that I had less of a problem once SP1 was installed, and that if you inherit from e.g. CompositeControl, have the project in your solution and go to design view it should appear in the toolbox. Glad you solved it another way though.
     

    // signature
    haf.se
Page 1 of 2 (18 items) 1 2 Next >