I have a C # / ASP.NET.aspx page that declares two controls, each of which represents the contents of one tab. I want a query string argument (e.g.? Tab = 1) to determine which of the two controls is activated. My problem is that they both go through initialization events and populate their child controls, losing CPU resources and slowing down response time. Is it possible to somehow deactivate them so that they do not go through any initialization?
My .aspx page looks like this:
<% if (TabId == 0)
{ %>
<my:usercontroltabone id="ctrl1" runat="server" />
<% }
else if (TabId == 1)
{ %>
<my:usercontroltabtwo id="ctrl2" runat="server" />
<% } %>
And this part works great. I assumed that <% would mean that the control would not actually be declared and therefore would not be initialized, but it is not ...