Calling ASCX user control randomly
Posted on 2014-09-09
Hello, I've a user control I register as follows:
<%@ Register TagPrefix="db" TagName="Banner" Src="~/Banner.ascx" %>
and I call it this way when I need it:
<db:Banner ID="Banner1" runat="server" />
My problem is that the file Im registering (banner.ascx) is not always the same.
Each customer may display a different file, as banner.ascx, or banner2.ascx, etc
The file name is stored on a session variable called banner, so when I try this:
<%@ Register TagPrefix="db" TagName="Banner" Src="~/<%=session("banner")%>" %>
I obviously get an error.
Is there a workaround to assign the name of the user control file randomly?