Caching question ASPNET and C#

G

Guest

Hi,

I have a wierd situation on my website, can anyone help me?

Scenario:
I have a page that depending what parameter receives loads one usercontrol
or other one.

Problem:
Sometimes when I click the link that goes to that page the page suddenly
appears with the wrong usercontrol and then flicks to the correct one, it
seems that is responding with the cache but after the execution shows the
correct one.

Generic code:

private MyUserControl Control1;
private MyUserControl2 Control2;
private TableCell Content;

On_Load()
{
Content.Controls.Clear();

if (MyCondition)
{
Control1 = (Control1) LoadControl ("MyUserControl.ascx");

Content.Controls.Add(Control1);
}
else
{
Control2 = (Control2) LoadControl ("MyUserControl2.ascx");

Content.Controls.Add(Control2);
}
}

I have not change the ASPX Page, so it has its default configuration, no
caching specified, only AutoEventWireup = "false"

Any ideas why is this happening? Is there any way to force the page not to
render until all the server code is executed?

Thanks a lot
Salva
 

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

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top