Custom web control problem

Discussion in 'ASP .Net Building Controls' started by Jim Buck, Oct 7, 2003.

  1. Jim Buck

    Jim Buck Guest

    I built a custom web control and can add it to the
    toolbox. However when I drag the control onto a web form
    niether the control tags nor the "register" directive get
    created. My class looks like the following, does anyone
    know what could be wrong. The custom control and the form
    are in different assemblies.

    [ToolboxItem(true),
    DefaultProperty("Name"),
    ToolboxBitmap(typeof
    (MyControl), "ToolboxBitmaps.MyControl.bmp"),
    ToolboxData("<{0}:MyControl runat=server></
    {0}:MyControl>")]
    public class MyControl : CustomControl
    {

    // Ommitted
    }
    Jim Buck, Oct 7, 2003
    #1
    1. Advertising

  2. Jim Buck

    Jim Buck Guest

    I figured out the problem.

    The default ToolboxItem type, which is used when you send
    true to the ToolBoxItemAttribute constructor is the
    ToolBoxItem. However since I am writing a web control I
    needed to use WebControlToolboxItem.

    Thanks

    >-----Original Message-----
    >I built a custom web control and can add it to the
    >toolbox. However when I drag the control onto a web form
    >niether the control tags nor the "register" directive get
    >created. My class looks like the following, does anyone
    >know what could be wrong. The custom control and the

    form
    >are in different assemblies.
    >
    >[ToolboxItem(true),
    > DefaultProperty("Name"),
    > ToolboxBitmap(typeof
    >(MyControl), "ToolboxBitmaps.MyControl.bmp"),
    > ToolboxData("<{0}:MyControl runat=server></
    >{0}:MyControl>")]
    >public class MyControl : CustomControl
    >{
    >
    > // Ommitted
    >}
    >.
    >
    Jim Buck, Oct 7, 2003
    #2
    1. Advertising

  3. "Jim Buck" <> wrote in message
    news:049101c38d01$c86ac4f0$...
    > I figured out the problem.
    >
    > The default ToolboxItem type, which is used when you send
    > true to the ToolBoxItemAttribute constructor is the
    > ToolBoxItem. However since I am writing a web control I
    > needed to use WebControlToolboxItem.
    >
    > Thanks


    No. Thank YOU!

    I was wondering why my ToolBoxData wasn't working! Now I know.

    Where did you find this out? Maybe the answers to my other control mysteries
    are there as well. :)
    --
    John Saunders
    Internet Engineer
    John Saunders, Oct 7, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jonah Olsson
    Replies:
    1
    Views:
    572
    Scott Allen
    Apr 5, 2005
  2. J R M
    Replies:
    2
    Views:
    430
    Charlie@CBFC
    Jun 1, 2006
  3. Matt Sokol
    Replies:
    2
    Views:
    379
    Theo Tillotson
    Aug 7, 2003
  4. Donald Simpson

    Web Custom Control & Custom Collection problem

    Donald Simpson, Jul 11, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    129
    Donald Simpson
    Jul 11, 2003
  5. Leyla

    Web user control - custom web control - java script.

    Leyla, May 1, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    122
    Leyla
    May 1, 2006
Loading...

Share This Page