Why can't I make a custom control from System.Web.UI.HtmlControls.HtmlControl?

Discussion in 'ASP .Net Building Controls' started by Chris, Nov 6, 2003.

  1. Chris

    Chris Guest

    Scenario:

    I make a custom control, inheriting from
    System.Web.UI.HtmlControls.HtmlControl as follows:
    public class MyControl : System.Web.UI.HtmlControls.HtmlControl
    {
    // ...
    }

    When I attempt to place it in my toolbox in VS, I get the message that
    there are no components in my assembly that can be placed on the
    toolbox. When I make a simple change to inherit from
    System.Web.UI.WebControls.WebControl, I can add the control without a
    problem, as follows:
    public class MyControl : System.Web.UI.WebControls.WebControl
    {
    // ...
    }

    This control does not need to incur the overhead of a WebControl, so
    I'd like to make it a "simpler" HtmlControl. Am I missing something?
    Can I not use a HtmlControl in the VS.NET toolbox? Is this the wrong
    control from which to inherit?

    --
    Thanks,
    Chris
     
    Chris, Nov 6, 2003
    #1
    1. Advertising

  2. On 6 Nov 2003 07:39:52 -0800, (Chris) wrote:

    >Scenario:
    >
    >I make a custom control, inheriting from
    >System.Web.UI.HtmlControls.HtmlControl as follows:
    >public class MyControl : System.Web.UI.HtmlControls.HtmlControl
    >{
    > // ...
    >}
    >
    >When I attempt to place it in my toolbox in VS, I get the message that
    >there are no components in my assembly that can be placed on the
    >toolbox. When I make a simple change to inherit from
    >System.Web.UI.WebControls.WebControl, I can add the control without a
    >problem, as follows:
    >public class MyControl : System.Web.UI.WebControls.WebControl
    >{
    > // ...
    >}
    >
    >This control does not need to incur the overhead of a WebControl, so
    >I'd like to make it a "simpler" HtmlControl. Am I missing something?
    >Can I not use a HtmlControl in the VS.NET toolbox? Is this the wrong
    >control from which to inherit?


    Nevermind. I see VS.NET does not allow it.
    --
    Chris Simmons
     
    Chris Simmons, Nov 6, 2003
    #2
    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. szabelin
    Replies:
    0
    Views:
    475
    szabelin
    Aug 4, 2003
  2. Tim Mulholland

    Make HtmlControl invisible

    Tim Mulholland, Aug 10, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    6,362
    Tim Mulholland
    Aug 13, 2004
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,138
    Smokey Grindel
    Dec 2, 2006
  4. Nathan Sokalski

    Creating A Custom HtmlControl

    Nathan Sokalski, Jul 23, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    558
    Gregory A. Beamer
    Jul 24, 2009
  5. Nathan Sokalski

    Creating A Custom HtmlControl

    Nathan Sokalski, Jul 23, 2009, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    829
    Gregory A. Beamer
    Jul 24, 2009
Loading...

Share This Page