Take a look at the following typical background (rough ):
To be honest, I'm tired of using it all. aspx files, such as the "friendship connection" module, there is "add friendship connection", "Modify friendship connection", and "friendship connection List". In simple words, you can combine "add" and "modify" into a file. Create a. aspx file every time. My current idea is to use "User Control + configuration file", although the number of files may not be much smaller. But when programming reaches a certain level, I think everyone will have the same idea as me.
The first thing to do is to dynamically Add a "user control", which can be dynamically loaded Based on passing parameters,CodeAs follows:Copy codeThe Code is as follows: protected control;
Protected void page_load (Object sender, eventargs E)
{
// By ahuinan 2009-4-18
Int id = convert. toint32 (request. querystring ["ID"]);
Switch (ID)
{
Case 0: // do not load User Controls
Response. Write ("You have not loaded any controls ");
Break;
Case 1: // load the user control
Control = page. loadcontrol ("~ /Login. ascx ");
Control. ID = "uc1"; // The name is used to obtain the value of the control.
Placeholder1.controls. Add (control );
Break;
Default:
Break;
}
}
You only need to use one. aspx file, which has a user control. The Code is as follows:Copy codeThe Code is as follows: <asp: placeholder runat = "server" id = "placeholder1"> </ASP: placeholder>
If the "user control" contains a textbox with ID "tbxusername", You need to obtain this value in the. aspx file. The Code is as follows:Copy codeThe Code is as follows: (textbox) placeholder1.findcontrol ("uc1"). findcontrol ("tbxusername"). Text
Here is a simple example of my ideas. I want to work with http://www.jb51.net/article/17829.htm.ArticleImplement a class that inherits from the page, and write the code for dynamically loading the user control in it. You need to work with a configuration file so that the menu on the left and the Dynamically Loaded control can be processed in the configuration file. The idea is very clear, but it is a bit messy. I hope my friends who have thought about it can talk to me. I have talked to a few friends recently, but none of them have such an idea.