I have a store implemented in ASP.NET/C#. There is a page – ReservationProduct.aspx – which has a control to show the product – BuyTourProduct – and another control to show product details – TourProductDetail.
I know it is good form to keep the two decoupled but this is for a very specific store use. I want the BuyTourProduct to be able to set a panel in the TourProductDetail control to be visible or not using PanelName.Visible=true|false.
How do I have one control set attributes on a panel in the other control? I hope I am saying this clearly enough.
By the way, this is a couple of 3rd product controls that I’m modifying so changing the fact that they are 2 separate controls is not really an option for us.
Thanks.
In the context of the UserControl, the user control is not aware of the other UserControl or it’s contents. You’ll need to interact with the controls at the Page context, because the Page is aware of both controls.
You will need two things:
If an event exists already, use that; otherwise, it will require you to modify the source of the BuyTourProduct, and expose an event and fire that event within that code. You’ll then also want to call this event from within the control.
Next, you’ll need to add a method to interact with PanelName inside TourProductDetail:
From the Page, you’ll subscribe to the event you want or the MyHideEvent: