I am trying to raise and handle events, between ASP.NET user controls (ascx) files.
So basically, I have an aspx page that contains two ascx user controls.
I raise an event from one of them, and handle the event in the other.
To make it very simple to code this, I've exposed (declared) each user control as public, in the code behind of the aspx page. Again, that makes it easy to do code all of this without having to do FindControl to get the controls.
In my main page for instance, I would have:
public UCQueueItem ucQueueItem;
public UCFiling ucFiling;
Each of these are user controls. I can then raise an event in one, and handle it in the other if I simple "wire" the event up from the main page, like so:
this.ucFiling.FilingChangedEvent += new FilingDetailsChangedEventHandler(ucQueueItem.Update_OnFilingDetailsChanged);
That all works well and good, UNTIL I use a RadPanelBar and include my ucQueueItem user controls within the panel bar. Since it then becomes a child of your control, I can no longer use the above syntax to wire up the event. THIS STINKS. I then have to do whacky "FindControl" stuff...
This type of behavior happens with all of your controls (like the grid, if you put items within Templates in the grid as well).
WHY WHY WHY, cannot I not access my publicly exposed controls, when they are nested within your controls?
Brent
So basically, I have an aspx page that contains two ascx user controls.
I raise an event from one of them, and handle the event in the other.
To make it very simple to code this, I've exposed (declared) each user control as public, in the code behind of the aspx page. Again, that makes it easy to do code all of this without having to do FindControl to get the controls.
In my main page for instance, I would have:
public UCQueueItem ucQueueItem;
public UCFiling ucFiling;
Each of these are user controls. I can then raise an event in one, and handle it in the other if I simple "wire" the event up from the main page, like so:
this.ucFiling.FilingChangedEvent += new FilingDetailsChangedEventHandler(ucQueueItem.Update_OnFilingDetailsChanged);
That all works well and good, UNTIL I use a RadPanelBar and include my ucQueueItem user controls within the panel bar. Since it then becomes a child of your control, I can no longer use the above syntax to wire up the event. THIS STINKS. I then have to do whacky "FindControl" stuff...
This type of behavior happens with all of your controls (like the grid, if you put items within Templates in the grid as well).
WHY WHY WHY, cannot I not access my publicly exposed controls, when they are nested within your controls?
Brent