아래 코드로 SharePoint 용 시각적 웹 파트가 있지만 click-handler 코드가 실행되지 않습니다. 동적으로 컨트롤을 만드는 경우 어떤 내 코드? 잘못된 것은클릭 이벤트가 발생하지 않습니다.
protected Button btApply;
protected void Page_Load(object sender, EventArgs e)
{
... some code ...
btApply = new Button();
btApply.Text = "Apply";
btApply.CssClass += "InputControl";
btApply.Click += new EventHandler(btApplyClick);
this.Controls.Add(btApply);
... some code ...
}
protected void btApplyClick(object sender, EventArgs e)
{
... some code ...
}
컨트롤의 초기화는 미리 수명 이벤트에 있어야 페이지 수명주기가 여러 가지 이벤트를 취할 수 있습니다. – JSJ