The purpose of our control is to put it in the page. According to different conditions, we can change the loaded user control!
In fact, the principle is the principle of MasterPage. This masterPage will be available in VS2005, but can now be implemented.
Use in my project:
MasterPage is four classes, where the container is dynamically load user controls. This feature will be everywhere in VS2005.
The following is a brief introduction to the dynamic loading of the leaves assembly:
We only need to change the address of the user component to dynamically change the loaded user components.
Dynamically change SkinPath in the program.
The component source code is as follows:
using System; // using System.Drawing; using System.Collections; using System.Collections.Specialized; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System Using system.Web.security; using region.components
Namespace region.controls {
[Parsechildren] ///
String SkinFileName = NULL; STRING SKINNAME = NULL; STRING SKINPATH;
// String ReturnURL = NULL; ///
///
///
///
///
}
For example, one of my applications:
Switch (Context.pageID) {CASE "1_1": base.skinpath = "~ / themes / signmanager / termlist.ascx"; break; case "1_1_1": base.skinpath = "~ / themes / signmanager / terminal.ascx" Break; Case "1_2": base.skinpath = "~ / themes / signmanager / memberlist.ascx"; Break; Case "1_2_1": base.skinpath = "~ / themes / signManager / membedit.ascx"; break; case "2_1": base.skinpath = "~ / themes / signmanager / cardsend.ascx"; Break; Case "3_1": base.skinpath = "~ / themes / signmanager / membernoEdit.ascx"; break; case "4_1": Base.skinpath = "~ / theme / acountedit.ascx"; Break; default: base.skinpath = "";
Based on the development development, we can save a lot of repetitiveness on the leaves. Simply quote the component in the place where the leaves is repeated
such as: