Turning off User Controls in ASP.NET

K

Kent Ogletree

I have built a user control that actually has 3 different sub user controls
embedded in it. Each of these sub controls displays data differently
depending on what a user selects and are tightly related to the others. The
problem I am running into is that even when I set visible to false, or even
disable the sub controls since they are not currently needed they still
execute and pull data from the database. This is going to make a major
performance hit on a production site.

How can I ensure the sub control is not active and does not execute its
code?

TIA,
Kent
 
C

Chris

Kent said:
I have built a user control that actually has 3 different sub user controls
embedded in it. Each of these sub controls displays data differently
depending on what a user selects and are tightly related to the others. The
problem I am running into is that even when I set visible to false, or even
disable the sub controls since they are not currently needed they still
execute and pull data from the database. This is going to make a major
performance hit on a production site.

How can I ensure the sub control is not active and does not execute its
code?

TIA,
Kent

Wrap the code you do not want to run with a "If Me.Visible Then"

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top