简体   繁体   中英

how to get the code file of another aspx page attached to my aspx page

My problem is to make a code behind file of an aspx ie already existing 1.aspx pages aspx.cs to be available to another page aspx with out replicating any of the code in code behind.

ie 1.aspx --> code file is 1.aspx.cs.

now 2.aspx --> code file is 1.aspx.cs

under the condition that the controls used in both aspx pages have identical Ids

Honestly, if you have such requirement, you should better encapsulate common behavior either in a base class that can be inherited by the two page's dedicated class, or create utility/business class that contains the code.

You should also consider using User Controls. This can help you to create reusable visual component in your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM