D
davidr
Hi,
I've read about bubble events and setting up the event args and several
other methods to have an event that occurs in a usercontrol flow up to
the parent. The problem is each one entails a lot of coding for just
one use control. Well, I have many user controls and am looking for a
very simple and universial approach. The problem is: I have a webpage
test.aspx and on it I can load any user control I want based on what
the user selects from a menu. Once the usercontrol is up. I want to
say click Save, do my database updates with the click event. Then
after that I want to load in a new usercontrol from the Main webpage.
Considering the size the application will be when someone clicks a
button, or save, or anything I can load many different user controls.
So is there a simple approach that I could take to call my public
LoadNewUserControl(usercontrolfile) method I have in the parent class?
I've seen people do something like this in the Button Click event
inside the user control, but it didn't work for me. The test class
doesn't exist or isn't a type that I can cast too.
Page aPage = (test) this.Parent;
aPage.LoadNewUserControl(test5.ascx);
Nor does this work:
this.Parent as test;
Anyways, Please a few recommendations on how to approach this.
Thanks,
David
I've read about bubble events and setting up the event args and several
other methods to have an event that occurs in a usercontrol flow up to
the parent. The problem is each one entails a lot of coding for just
one use control. Well, I have many user controls and am looking for a
very simple and universial approach. The problem is: I have a webpage
test.aspx and on it I can load any user control I want based on what
the user selects from a menu. Once the usercontrol is up. I want to
say click Save, do my database updates with the click event. Then
after that I want to load in a new usercontrol from the Main webpage.
Considering the size the application will be when someone clicks a
button, or save, or anything I can load many different user controls.
So is there a simple approach that I could take to call my public
LoadNewUserControl(usercontrolfile) method I have in the parent class?
I've seen people do something like this in the Button Click event
inside the user control, but it didn't work for me. The test class
doesn't exist or isn't a type that I can cast too.
Page aPage = (test) this.Parent;
aPage.LoadNewUserControl(test5.ascx);
Nor does this work:
this.Parent as test;
Anyways, Please a few recommendations on how to approach this.
Thanks,
David