Problem with Events - not a newbie question

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
I wanted to say it's not a newbie question sense it looks like one in the title :)

Okay, so here's the deal, on a Page I have three panels, we'll call them panel A, B, and C for short. Panel A is loaded with UserControl A at design time.

User Control A and Bx both have a field that holds a control that is accebile through an interface since the control varies. UserControl Cx is unique and not important at this time.

At run time UserControl A decides which UserControl B will go into Panel B based upon a click on what LinkButton in the user control itself (A) is clicked or a default value.

At run time UserControl B decides which UserControl C will go into Panel C based upon a click on what LinkButton in the user control itself (B) is clicked or a default value (very similiar to UserControl A).

I must use ViewState in order for UserControl A to load the correct UserControl B if a link button is clicked on UserControl B, other wise UserControl A doesn't detect that any LinkButton was clicked on it and therefore doesn't load UserControl B at all, and therefore no event would be raised on UserControl B because it is no longer present.

Now the problem... while clicking on a link button is UserControl B does cause a PostBack, and UserControl A re-loads UserControl B based on ViewState, the object that was clicked in UserControl B never has its event fired (and yes it's wired up)... why... probably because UserControl A is loading it again thus wiping out any events that would rise... I'm not sure on that... ViewState isn't my strong point.

I think it is apparent what I'm trying to do, but I'm having problem implementing it. Some help or suggestions would greatly be appreciated.

Thanks!
 
Back
Top