I Use the following method, I have a "Main" Control which is responsible for loading each of the other ascx files and displaying them, its an empty .ascx file with only the following code in it:
public abstract class Configurator : PortalModuleBase, IActionable, IPortable, ISearchable
{
string _DefaultPage = "~/DeskTopModules/Novasoft-Configurator/Main.ascx";
....
private void Page_Load(object sender, System.EventArgs e)
{
try
{
if(Request.Params["ControlPath"] != null)
{
string ControlPath = Request.Params["ControlPath"];
_DefaultPage = "~/DeskTopModules/Novasoft-Configurator/" + ControlPath;
}
PortalModuleBase objModule = (PortalModuleBase)this.Page.LoadControl(_DefaultPage);
if(objModule != null)
{
objModule.ModuleConfiguration = this.ModuleConfiguration;
Controls.Add(objModule);
}
}
catch (Exception exc)
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
....
I Pass the name of the .ascx file i want to load in the url as ControlPath=****.ascx
I Cant take credit for this code though, i got it from another dnn module, i just cant remember which one right now.
"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction." --Albert Einstein