I have an ASP.Net Web Project that uses a master page.
This master page contains a menu in the form of a user control.
Sometimes I want to dynamically change this to use a different type of menu user control.
The current code to register the user control
<%@ Register TagPrefix="chase" TagName="topMenu" Src="~/UserControls/TopMenu.ascx" %>
Inside the body tags
<chase:topMenu runat="server" />
Is there anyway I can change the "SRC" attribute in the register code dynamically to use a different user control?!
Help greatly appreciated
Tried This Code But I Receive An 'Invalid Cast Exception'
TopMenu uh3 = (TopMenu)this.LoadControl("~/UserControls/TopMenu.ascx");
'Unable to cast object of type 'ASP.usercontrols_topmenu_ascx' to type 'SwintonTaxiWeb.UserControls.TopMenu'.'