Question

I am using the Elastic CSS framework on an ASP.NET site. It is doing a great job of sizing the various containers I have until an UpdatePanel executes a partial postback. The solution as I understand it is to execute the following line of javascript

Elastic.refresh();

I'm pretty good with C# and ASP.NET but not so much with javascript. As I understand it, RegisterStartupScript only registers the script, I still need a control to then execute it.

So how can I get this one line of javascript to execute when a custom control catches a custom exception and causes a partial postback?

Was it helpful?

Solution

Edit

In javascript on your page you could also try something like this

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoadedHandler);
function PageLoadHandler()
{
    Elastic.refresh();
}

This handler will run after any callback but sender._postBackSettings.panelID will allow you to filter it to the panel you want.

Alternativly you could try if end request fits your needs better.

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function PageLoadHandler()
{
    Elastic.refresh();
}

Original

Do you have a ScriptManager control on the page that has the UpdatePanel? If so you might be able to leverage the ScriptManager.AsyncPostBackError and have it execute your method.

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.asyncpostbackerror.aspx

OTHER TIPS

This is a guess, but I'd try using a literal control w/in the ajax panel that contained the following:

<script language="javascript">
Elastic.refresh();
</script>

If I'm right the Ajax panel will reload and that will automatically execute that line of code when it does.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top