Link to home
Start Free TrialLog in
Avatar of robaherne
robaherne

asked on

Affecting controls outside an UpdatePanel during an Ajax server request

I have an UpdatePanel that periodically checks a database for changes. When a particular change is detected i'd like to change the visible property of a Panel outside of the UpdatePanel to false. I guess this requires a page postback/refresh of some kind... but since Ajax only refreshes bits of the page, it has no effect.

The way I was thinking to solve it was to do something like this...

if (condition is met)
{
    somePanel.Visible = false;
   
    force page postback ????????
}

That way i'm thinking it'll reload the page and take into account the property changes to the Panel. How do I force a page refresh from the code behind? or is there some other way of doing this that I'm missing?

Thanks!
Avatar of ajolly
ajolly
Flag of India image

I will suggest you to use ScriptManager.RegisterStartupScript, and use a javascript code here to make the panel invisible.

ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "JAVA SCRIPT CODE", false);
ASKER CERTIFIED SOLUTION
Avatar of David Robitaille
David Robitaille
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robaherne
robaherne

ASKER

Thanks! I ended up just including the Panel I wanted to make invisible in the original UpdatePanel... your way would work better tho. I'll give it a go