M
moondaddy
I need to replace a user control on a page with a different user control.
The challenge I'm faced with is that this call is being made from the user
control being replaced.
Normally I replace one user control with another user control like this
'Using vb.net 1.1
ctl = LoadControl(ctlPath)
Me.cellControlHolder.Controls.Clear()
Me.cellControlHolder.Controls.Add(ctl)
However, here's the unique scenario I'm working with now: The main (parent)
page is default.aspx and in Me.cellControlHolder (in default.aspx) I've
loaded ShoppingCart.ascx. Now in the shoppingcart control a user clicked on
a the checkout button and in that onclick event I found that the user hasn't
logged in yet. So now I want to replace the shopping cart user control with
the Login.ascx user control. But keep in mind that this code is running in
the shopping cart control. In an nutshell I need to call a method from in
the shoppingcart control to its parent (default.aspx) and this method will
run this:
ctlPath="blablabla/Login.ascx"
ctl = LoadControl(ctlPath)
Me.cellControlHolder.Controls.Clear()
Me.cellControlHolder.Controls.Add(ctl)
Any great ideas on how to do this?
The challenge I'm faced with is that this call is being made from the user
control being replaced.
Normally I replace one user control with another user control like this
'Using vb.net 1.1
ctl = LoadControl(ctlPath)
Me.cellControlHolder.Controls.Clear()
Me.cellControlHolder.Controls.Add(ctl)
However, here's the unique scenario I'm working with now: The main (parent)
page is default.aspx and in Me.cellControlHolder (in default.aspx) I've
loaded ShoppingCart.ascx. Now in the shoppingcart control a user clicked on
a the checkout button and in that onclick event I found that the user hasn't
logged in yet. So now I want to replace the shopping cart user control with
the Login.ascx user control. But keep in mind that this code is running in
the shopping cart control. In an nutshell I need to call a method from in
the shoppingcart control to its parent (default.aspx) and this method will
run this:
ctlPath="blablabla/Login.ascx"
ctl = LoadControl(ctlPath)
Me.cellControlHolder.Controls.Clear()
Me.cellControlHolder.Controls.Add(ctl)
Any great ideas on how to do this?