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.aspx → DetailsForm.cs开发者_运维知识库 and BoxDetailsForm.aspx → DetailsForm.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.
加载中,请稍侯......
精彩评论