시각적 웹 파트와 두 개의 usercontrol이 있습니다. 비주얼 웹 부분 Page_Load()
에서 동적으로 userControl1
만들기 : UserControl1에있어서다른 사용자 컨트롤에서 동적으로 생성 된 사용자 컨트롤에서 클릭 이벤트가 발생하지 않습니다.
protected void Page_Load(object sender, EventArgs e)
{
UserControl1 userControl = Page.LoadControl(userControl1Path) as UserControl1;
userControl.ID = "UserControl1";
this.Controls.Clear();
this.Controls.Add(userControl);
}
을 난 버튼로드하는 제 2 사용자 제어 (UserControl2를)가 (그리고 작동!) 또한
protected void GoToUserControl2_Click(object sender, EventArgs e)
{
UserContol2 userControl = Page.LoadControl(userControl2Path) as UserContol2;
userControl.ID = "UserContol2";
this.Controls.Clear();
this.Controls.Add(userControl);
}
UserControl2
버튼이 있지만 클릭 할 때 클릭 이벤트가 발생하지 않습니다. 대신 버튼을 클릭하면 UserControl1
으로 리디렉션됩니다. 버튼에 아무런 이벤트가 없더라도 UserControl1
으로 리디렉션됩니다.
도와주세요.
하는 페이지로드에 브레이크 포인트를 넣어, 당신이를 Page_Load 함수가 다시 포스트가있을 때마다 실행됩니다 통지합니다, 나는 당신의 페이지로드는 컨트롤이 지워 의심 및 제어 1의 이벤트를 사용 –