views:

816

answers:

2

I have a ASP.NET 3.5 web site with an AJAX update panel. I simply need to process some server side code and then issue a user prompt that says "Code processing complete".

I know there is supposed to be support for Msgbox-esque methods in ASP.NET but I can't find them and any other JavaScript based solutions don't work effectively when you have an update panel.

Help.

A: 

MsgBox doesn't exist, but look at the javascript alert() function. That'll popup the message for you.

here is a link with more information on javascript popups

If you want to inject javascript from the server-side code, you can use this:

ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Code processing complete.');",True)
Gabriel McAdams
This answer doesn't take into account the fact that I posted about AJAX and the update panels.
Jim Beam
why doesn't it? There is no way to show a message in the browser without javascript or some other client script (VB Script is supported by IE). If you want to do it with AJAX and UpdatePanels, then add javascript to the page.
Gabriel McAdams
Remember asp.net is server side code. If you want anything to occur on the client, you have to generate code and send it to the browser.
Gabriel McAdams
A: 

Hey,

Couldn't find a direct example for this, so you can see how this is being used, and change it for your needs. On the client, there is a get_isInAsyncPostback() method to check if an updatepanel will be performing an async postback.

This link shows you how to cancel an update: http://www.asp.net/ajax/documentation/live/Tutorials/CancelAsyncPostback.aspx

Using the themes in this, instead of the beginRequest, you can tap into the endRequest event, and if an async postback, you can post an alert here. This assumes that the code works successfully, which are you adding that detection?

HTH.

Brian