views:

345

answers:

1

I implemented a save-draft trick using an update panel whereby I handle the updatepanel's asynch postback on the server side and then to avoid resending the same html data I throw an exception with the current datetime as message and then capture it on the client side where i do some transformation and html injection to let the user know that a draft of his current work has been saved (TERRIBLE!).

The original idea was to handle the asynch postback and then override the rendering method of the update panel to send xml or javascript data that could be captured and processed on the client side stopping the update panels refresh from occuring.

Has anyone tried this kind of functionality using update panels?

+1  A: 

I don't think that an UpdatePanel is really what you want here. If you're wanting to get the response back and have the best control over the response you should look at standard AJAX requests.

An UpdatePanel isn't something that you can really control the response of all that well, you can tie into the endRequest event handler on the PageRequestManager, there you can check the respose. Here's the details on the eventArgs you get back - http://msdn.microsoft.com/en-au/library/bb384175.aspx

But throwing an Exception isn't a good idea because nothing exceptional has happened, which is what an exception is ;)

Slace