Could I add component to toolbox in VS2005 WebSite Project?

Discussion in 'ASP .Net' started by alberthung01, Jul 24, 2007.

  1. alberthung01

    alberthung01 Guest

    Hi all,
    I wrote a component with ComponentDesigner
    to let users drag and drop it to WebPage from toolbox directly.
    Just like the behavior of dataAdapter.
    But it works fine on ASP.NET 1.1 but not on ASP.NET 2.0.
    Sometimes I add it to toolbox in VS2005 WebSite Project but it will
    not appear.
    And always it can't be drag and drop to WebPage any more.
    Nothing will be added to page after that.

    Here is my code structure
    ---------------------------------------
    //Class
    [ToolboxItemFilter("System.Web.UI",ToolboxItemFilterType.Require),
    Designer(typeof(Ares.Workflow.WebControls.AFWebUIControlDesigner))
    ]
    public class AFWebUIControl : System.ComponentModel.Component
    {
    public AFWebUIControl()
    {
    }
    }

    //Designer
    public class AFWebUIControlDesigner : ComponentDesigner
    {
    public override void Initialize(IComponent component)
    {
    base.Initialize(component);
    }
    }
     
    alberthung01, Jul 24, 2007
    #1
    1. Advertisements

  2. Albert,

    This one got me for a little while too. Microsoft changed some Visual Studio
    functionality when they went to Visual Studio 2005.

    In the previous version you could drag a component control onto a page (in
    design view) and the Component Designer window would appear at the bottom of
    the page.

    In Visual Studio 2005 the component designer has been separated from the
    display page. Component Designer objects won't even appear in the toolbox
    unless the new component designer window has been displayed first. To do so:
    Go to the design view of one of your pages and then in the menu go to
    View - Component Designer. Like magic your toolbox should now contain your
    component and let you drag it to the designer.

    Regards,

    --
    S. Justin Gengo, MCP
    [email protected][-NoSpam-].com

    Free code library at:
    www.aboutfortunate.com
     
    S. Justin Gengo, Jul 25, 2007
    #2
    1. Advertisements

  3. alberthung01

    alberthung01 Guest

    Hi Justin,
    Thanks for your help!
    It works now after I remove the ToolboxItemFilter and display the
    Component Designer.
    Really magic!

    Best Regards,
    Albert
     
    alberthung01, Jul 26, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.