Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的问题是制作一个 aspx 文件的代码隐藏文件,即已经存在的 1.aspx 页 aspx.cs 可用于另一个页 aspx,而无需复制代码后面的任何代码。
即 1.aspx --> 代码文件为 1.aspx.cs。
现在 2.aspx --> 代码文件是 1.aspx.cs
在两个aspx页面中使用的控件具有相同Id的情况下
老实说,如果您有这样的要求,您应该更好地将常见行为封装在可以由两个页面的专用类继承的基类中,或者创建包含代码的实用程序/业务类。
您还应该考虑使用用户控件。这可以帮助您在应用程序中创建可重用的可视化组件。