1
我的代碼:出現無法添加自定義控件到的UpdatePanel
protected void Button1_Click(object sender, EventArgs e)
{
CustomControl myControl = new CustomControl();
UpdatePanel1.ContentTemplateContainer.Controls.Add(myControl);
Button btn = new Button();
UpdatePanel1.ContentTemplateContainer.Controls.Add(btn);
}
點擊後新按鈕,但我的控制沒有。 CustomControl如果罰款(?),因爲我可以將其添加到.aspx文件中,並且它沒有任何問題。
我錯了什麼?
btw。沒有錯誤或警告,它只是不添加自定義控件到HTML頁面。