Wednesday, July 15, 2009

How to trigger a full postback from within an AJAX UpdatePanel

If you've ever used an AJAX UpdatePanel and needed to have a control within the UpdatePanel cause a full postback of the page, here's how you do it.

ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
if (scriptManager != null)
{
scriptManager.RegisterPostBackControl(SaveButton);
}

First you have to get access to the ScriptManager on the page. Then you register the control within the UpdatePanel that needs to trigger a full postback.

No comments: