Load Control Issue

D

davinder.kainth

Hi,

I'm a bit new to ASP.net but I've been using it for a few week and have
come across a problem with user controls, well its really to do with
when they are loaded.

Basically I have 2 controls (a.ascx and b.ascx for example) and a main
page, the main page loads both of the controls when it is given to the
client. The idea is that the user will click on a link in control "a"
and will cause control "b" to be loaded.

This currently only sort of works. The way i have set it up is that
after clicking in control "a" the viewstate of the main page is updated
and then when the page reloads it uses these values in the viewstate to
display the relevant user control. As I said this only sort of works,
if i click the link in control "a" twice then control "b" changes.
It seems that after clicking the link the page_load method runs and
then the viewstate is updated, meaning when the page is returned to the
client it was based on the old viewstate.

So the way I see it I either need to find a way to change the viewstate
before the page_load bit runs or need to refresh the page after the
viewstate has been updated. But as I say I'm new to ASP.net so there
maybe other options that I have not considered. Does anyone have any
idea on how I can sort this out?

Cheers
Davinder
 

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,781
Messages
2,569,615
Members
45,293
Latest member
Hue Tran

Latest Threads

Top