添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

The difference between the windows forms example and the web forms example, is the control has a tagged portion. I imagine this can be overcome, some day, as web applications compile everything (at least in some instances), but it is not the case today.

You can, however, slap a user control on another user control, ad nauseum. It will not give you inheritance, but it does allow you to adorn a particular control with additional controls by making a composite of the original control and the stuff you need to add to it. That might solve your problem?

I understand. Unfortunately, I don't think there is today, due to the separation of tags and code. Gregory A Beamer Mar 12, 2009 at 17:46 "You can, however, slap a user control on another user control, ad nauseum". YES YES YES. Completely didn't think of nesting UserControls Greg B Jun 19, 2009 at 10:33

You could certainly inherit the base user control in code and insert your additional controls in code, if you are talking building in a visual designer then I'm not sure. I'm aware of creating composite controls from both system.web controls and user controls so there's no reason that your new control couldn't contain another user control with additional controls added around it.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .