|
Hi All, suppose I have a common ASP.NET page named CommonPage.aspx which has several user controls (e.g. buttons), how may I create a inherited page which inherits the user controls from CommonPage.aspx, however together with its own other user controls (e.g. checkbox ,text box...). Inheritance is simple in Windows Form applications, however, it becomes unclear how I can do that in ASP.NET web applications. Must a lot of HTML code be written in the code file behind (.aspx.cs)?
Appreciate if you could provide some samples!
Thank you.
|
|
|
What would you accomplish by inheriting a page? The standard technique for ecapsulation/re-use is to create user controls.
|
|
|
|
|
The purpose of inheriting the page is to avoid duplicating code (e.g. function calls) as there are some user controls (e.g. buttons) will be the same in different web pages.
<Added>
is the "user control" you are referring to "web user control"? which we may find in the drop down menu by right clicking a web solution->Add->Add Web User Control?
<Added>
I think web user control may solve my problem. Thanks
|
|
|
Yes, that's it exactly. You're welcome.
|
|
|
|
|
|
|
|
|
|