的加载期问题,也是ascx文件多包含问题
大可山人 博客专家认证 2004-12-27 06:49:59 在一个Menu_AboutUs.ascx中有这样一段:
<!-- #include file="MenuLeft.ascx" -->
....
<table width="88" border="0" align="center" cellpadding="0" cellspacing="0" background="<%=BackgroundImage%>">
....
而MenuLeft.ascx文件中有一段:
private string _backgroundImage="~/indexC/leftSubButtonBg.gif";
public string BackgroundImage
{
get { return _backgroundImage; }
set { _backgroundImage = value; }
}
以上用法能正常使用。
但如果将Menu_AboutUs.ascx中<!-- #include file="MenuLeft.ascx" -->改为:
<%@ Register TagPrefix="MyMenu" TagName="MenuLeft" Src="MenuLeft.ascx" %>
<form runat="server">
<MyMenu:MenuLeft runat="server" />
....
<table width="88" border="0" align="center" cellpadding="0" cellspacing="0" background="<%=BackgroundImage%>">
....
</form>
时就报错?
(问题就在这里:<%=BackgroundImage%>)
应该如何解决类似这种ascx中包含ascx的问题?
include的加载期是在什么位置?