D
Dan
hi,
i have a page with two usercontrols:
1. a static menu control.
2. a dynamically loaded control as user interface
the main page receives events from the menu and sets the apropriate
ui control in the OnBubbleEvent method.
but now, the ui control doesnt't fire any events any more. i first have
to do another postback, and now the ui fires again.
what's wrong there?
it seems to me that only if the actual usercontrol has been added in the
pageload method, the control somehow is asigned to the page.
if the uc gets added later (OnBubbleEvent), the conection seems to get lost.
here some code:
main page:
private void Page_Load(object sender, System.EventArgs e)
{
control=this.LoadControl("x");
this.FindControl("Form1").Controls.Add(control);
}
override protected bool OnBubbleEvent(object sender, System.EventArgs e)
{
int index=this.FindControl("Form1").Controls.IndexOf(control);
//if menu button has been clicked, load the apropriate uc:
control=this.LoadControl("x");
this.FindControl("Form1").Controls.RemoveAt(index);
this.FindControl("Form1").Controls.Add(control);
}
as soon as the control stems from the OnBubbleEvent, nothing gets fired.
when the button of the control gets clicked another time (postback)
and the pageload sets the actual control, everything is fine again.
so, the event fires only 50% of the click.
i don't understand that.
thanks very much for any help.
dan
i have a page with two usercontrols:
1. a static menu control.
2. a dynamically loaded control as user interface
the main page receives events from the menu and sets the apropriate
ui control in the OnBubbleEvent method.
but now, the ui control doesnt't fire any events any more. i first have
to do another postback, and now the ui fires again.
what's wrong there?
it seems to me that only if the actual usercontrol has been added in the
pageload method, the control somehow is asigned to the page.
if the uc gets added later (OnBubbleEvent), the conection seems to get lost.
here some code:
main page:
private void Page_Load(object sender, System.EventArgs e)
{
control=this.LoadControl("x");
this.FindControl("Form1").Controls.Add(control);
}
override protected bool OnBubbleEvent(object sender, System.EventArgs e)
{
int index=this.FindControl("Form1").Controls.IndexOf(control);
//if menu button has been clicked, load the apropriate uc:
control=this.LoadControl("x");
this.FindControl("Form1").Controls.RemoveAt(index);
this.FindControl("Form1").Controls.Add(control);
}
as soon as the control stems from the OnBubbleEvent, nothing gets fired.
when the button of the control gets clicked another time (postback)
and the pageload sets the actual control, everything is fine again.
so, the event fires only 50% of the click.
i don't understand that.
thanks very much for any help.
dan