1. Implemented functions: For multi-city projects, a new function is launched in a city, and some other cities maintain old user controls,
2. It was written in this way before. After tracking, we found that Beijing still uses the user control code, that is, the user control is already on the page, this step is a waste of effort.
3. Solution: Change page a to PlaceHolder and dynamically load the data in the background (Note: The actual path of the project in the LoadControl () method may be different from the namespace)
B Also has a clever method. In the user control, page_load determines that it is Beijing, this. visible = false, return; that is, although the control is still used, it is directly displayed.
<! -- Start --> <div id = "div_inte"> </div> <% if (cityName! = "Beijing") {%> <uc: interested runat = "Server" id = "ucinterested"> </uc: interested ><%} else {%> <! -- # Include virtual = "/gaa/aa.htm" -- ><%}%> <! -- End -->
<! -- Start -->
<Div id = "InterestedHouse"> </div>
<% If (cityName! = "Beijing ")
{%>
<Asp: PlaceHolder ID = "PlaceHolder1" runat = "server"> </asp: PlaceHolder>
<%} Else {%>
<! -- # Include virtual = "/aa/aa.htm" -->
<% }%>
<! -- End -->
Protected usercontrol. Detail. housedetail. Interested ucinterested = new usercontrol. Detail. housedetail. Interested (); If (cityname! = "Beijing") {ucinterested = (usercontrol. detail. housedetail. interested) loadcontrol ("/esfhouse/usercontrol/detail/interested. ascx "); placeholder1.controls. add (ucinterested); ucinterested. projname = ahse. projname; ucinterested. purpose = ahse. purpose; ucinterested. room = ahse. room. tostring (); ucinterested. district = ahse. district; ucinterested. comarea = ahse. comarea; ucinterested. houseid = ahse. houseid. tostring ();} else {}