You can do something like this before calling RenderControl: Page page = new Page() page.Controls. Add(report) In this case Init method will be called an answer given on that link of yours.
You can do something like this before calling RenderControl: Page page = new Page(); page.Controls. Add(report); In this case Init method will be called. An answer given on that link of yours.
Sorry, but the events are not being fired. – Podge Jan 19 at 17:06.
The standard Load event should fire just fine. The standard ASP. Net control events are raised for usercontrols.
If you are wanting to fire events inside your usercontrol from the parent page then you'll want to do something like this: Inside your usercontrol create an event and wire it up. In this example I'll call it from Page_Load: public event EventHandler TestEvent; protected void Page_Load(object sender, EventArgs e) { if (this. TestEvent!
= null) { this. TestEvent(this, e); } } Inside your parent page wire up the user controls TestEvent: protected override void OnInit(EventArgs e) { MyUserControl uc = LoadControl("~/PathToUserControl. Ascx"); uc.
TestEvent += new EventHandler(MyUserControl_TestEvent); } protected void MyUserControl_TestEvent(object sender, EventArgs e) { //this code will execute when the usercontrol's Page_Load event is fired. } Hope that helps!
I need to load a web user control dynamically. Looking at http://weblogs.asp.net/srkirkland/archive/2007/11/05/dynamically-render-a-web-user-control.aspx, it states that the page lifecycle events are not fired. I thought I might be able to raise the events through reflection.
I cannot figure how to fire the events, am I missing something?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.