我動態加載控件並將文本傳遞給控件。但是,當我設置公共財產時,我得到了一個無例外的例外。C#公共屬性未處理的異常
我的控制是:
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);
錯誤那張集合{說法只是未處理的異常