webform1.aspx前台

来源:互联网 发布:设计软件有哪些 编辑:程序博客网 时间:2024/05/18 09:18

webform1.aspx前台
<%@ Register TagPrefix="uc1" TagName="WebUserControl1" Src="WebUserControl1.ascx" %>
<uc1:WebUserControl1 id="WebUserControl11" runat="server"></uc1:WebUserControl1>
-------------------------------------------------------------
webform1.aspx后台
public WebUserControl1 WebUserControl1;
WebUserControl1.word="hello";
WebUserControl1.repeat(50);

===============================================================================
编译时没报错,但页面显示是报
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。

源错误:


行 22:   {
行 23:    // 在此处放置用户代码以初始化页面
行 24:    WebUserControl1.repeat(50);
行 25:   }
行 26: