我正在动态加载控件并将文本传递给控件。但是当我设置公共财产时,我遇到了一个未经处理的异常。
我的控制是:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace g247_Test.controls
{
public partial class carousel_guards : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public String pcode
{
get
{
return pcode;
}
set
{
pcode = value;
}
}
}
}
加载上一页上的控件:
carousel_guards webUserControl = (carousel_guards)Page.LoadControl("~/controls/carousel-guards.ascx");
webUserControl.pcode = "rg402eg";
phGuardsList.Controls.Add(webUserControl);
错误发生在集合 { 说只是未处理的异常