Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 嵌套页中的异常查找控件(asp.net)_C#_Html_Asp.net_Code Behind - Fatal编程技术网

C# 嵌套页中的异常查找控件(asp.net)

C# 嵌套页中的异常查找控件(asp.net),c#,html,asp.net,code-behind,C#,Html,Asp.net,Code Behind,我曾经为我的网页开发过一些东西,但现在不行了 我想在我的aspx.cs页面中加载一个控件(ul),但它引发了一个异常 我的html如下所示: <ul class="offer-list offer-small list-content" id="latestOffers" runat="server"> <li> base {System.Web.UI.HtmlControls.HtmlContainerControl} = {Inne

我曾经为我的网页开发过一些东西,但现在不行了

我想在我的aspx.cs页面中加载一个控件(ul),但它引发了一个异常

我的html如下所示:

<ul class="offer-list offer-small list-content" id="latestOffers" runat="server">
                <li>
base {System.Web.UI.HtmlControls.HtmlContainerControl} 
= {InnerText = '((System.Web.UI.HtmlControls.HtmlContainerControl)
(((System.Web.UI.HtmlControls.HtmlGenericControl)(ulLatestOffers)))).InnerText
' threw an exception of type 'System.Web.HttpException'}
这是在我的页面加载方法中

我得到了这样的东西:

<ul class="offer-list offer-small list-content" id="latestOffers" runat="server">
                <li>
base {System.Web.UI.HtmlControls.HtmlContainerControl} 
= {InnerText = '((System.Web.UI.HtmlControls.HtmlContainerControl)
(((System.Web.UI.HtmlControls.HtmlGenericControl)(ulLatestOffers)))).InnerText
' threw an exception of type 'System.Web.HttpException'}
这是可行的,但现在不行了

怎么了?你们能帮帮我吗

ullo = HtmlGenericControl) this.Master.FindControl("ContentPage").FindControl("latestOffers");

我猜这条线在你的构造器上。添加一个新方法,比如说
InitControl()
,然后在那里运行此代码。

我已经这样做了。没用。我创建了一个方法并从page load方法调用它。