How (if at all) can you make an ASP.NET UserControl inherit from another UserControl?

前端 未结 3 1322
不思量自难忘°
不思量自难忘° 2021-01-11 13:41

In Windows Forms it\'s easy to inherit one user control from another. The inherited control contains all the controls of the parent form, and you can add some more. Can the

3条回答
  •  不要未来只要你来
    2021-01-11 14:02

    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?

提交回复
热议问题