使用相同的code隐藏文件多的.aspx页面 [英] Using the same code behind file for multiple .aspx pages
本文介绍了使用相同的code隐藏文件多的.aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正在开发一个网站 CMS
的文件推到我们的生产服务器中。如果 .apsx
页面创建共享隐藏文件相同的code,这将导致一个问题?
We are developing a site inside a CMS
that pushed files to our production server. If the .apsx
pages created share the same code behind file, will this cause a problem?
推荐答案
为什么你不让这两个页面来自同一个类继承?
Why don't you let both pages inherit from the same class?
public class MyPage : System.Web.UI.Page
{
// common logic that both pages should have
protected void Page_Load(object sender, EventArgs e)
{
}
}
public partial class PageA : MyPage
{
// specific logic for page A
}
public partial class PageB : MyPage
{
// specific logic for page B
}
这篇关于使用相同的code隐藏文件多的.aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文