Dear all,
I have been looking on the internet a lot for this. My webservice needs to render a web user control with a .ascx. Now I thought it would be easy with the AutoEventWireUp="true" inside the .ascx file, but it did not do the trick. My user control is being punt on a PageHolder and then being rendered. I can also call a method of the control in the way i am doing it now, but i prefer the constructor or the page_load.
The code I use now is the following:
Page pageHolder = new Page();
WebApplication3.WebUserControl2 control;
try
{
control = (WebApplication3.WebUserControl2) pageHolder.LoadControl("~/WebUserControl2.ascx");
//WebApplication3.WebUserControl1 control = new WebApplication3.WebUserControl1("test123");
}
catch(Exception ex)
{
return ex.ToString();
}
pageHolder.Controls.Add(control);
control.test();
System.Text.StringBuilder sb = new S ...
Go to the complete details ...