Hi (sorry for the bad title)
I have a user control that loads various additional user controls based on conditions such as this:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SubPage.ascx.cs" Inherits="SubPage" %> <%@ Register Src="<srcA>" TagName="A" TagPrefix="CTRL" %> <%@ Register Src=">srcB>" TagName="B" TagPrefix="CTRL" %> <% if (someValue == 1) { %> Loading user control A.. <CTRL:A runat="server" /> <% } else { %> Loading user control B.. <CTRL:B runat="server" /> <% } %>
The result will look right; expected content is displayed. But I noticed that even if someValue! = 1 is displayed and control B, control A is still loading backstage (page loading is called).
Why is this? And what would be a better approach? Thanks.
Olavj source share