User Control background Loading

Source: Internet
Author: User

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 {}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.