开发者

How do I inherit from an abstract UserControl?

If I have a class

abstract class DetailsForm : UserControl

then

AppDetailsForm : DetailsForm
BoxDetailsForm : DetailsForm

I can take advantage of inheritance to stick logic in DetailsForm.cs that applies to elements common among the tags in AppDetailsForm.aspx and BoxDetailsForm.aspx. These tags appear in both, in exactly the same place. There is duplicated header and footer code in AppDetailsForm.aspx and BoxDetailsForm.aspx that I'd rather stick in DetailsForm.cs.

The problem is I would need to stick a reference in DetailsForm.aspx that would refer to the content of the .aspx file in a child derived directly from that class.

However, currently, it only shows the content of AppDetailsForm.aspx or BoxDetailsForm.aspx, and ignores anything in DetailsForm.cs, so it seems like the reference to the other file should go AppDetailsForm.aspxDetailsForm.cs开发者_运维知识库 and BoxDetailsForm.aspxDetailsForm.cs.

I don't know how to do this, and I suspect I'm approaching this the wrong way.


I think Master pages are built for what you are trying to do.

Take a look at this link.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜