私の ASP.Net ページには、PlaceHolder と Button があります。ユーザーがこのボタンをクリックすると、Interface メソッド getControl からいくつかの UserControls を PlaceHolder に追加します。コード:
protected void ActionBtn_Click(object sender, EventArgs e)
{
if (provider != null)
{
actualObject = (PlaceHolder)provider.getControl();
PlaceHolder1.Controls.Add(actualObject);
}
}
メソッド getControl:
public object getControl()
{
ph = new PlaceHolder();
exportInbBtn = new Button();
exportInbBtn.Text = "Export Inventury";
exportInbBtn.Click += new EventHandler(myButton_ServerClick);
ph.Controls.Add(exportInbBtn);
exportInbBtn.ID = "exportInbBtn";
return ph;
}
ASP ページのメソッド Page_Load と Page_Init は空です。問題は、ユーザーがボタン exportInbBtn (テキスト: "Export Inventury") をクリックすると、クリック イベント myButton_ServerClick が発生しないことです。Web ページの更新のみ。私はいくつかの答えを用意していますが、この問題をどのように簡単に解決できるかわかりません。