2012年3月26日月曜日

Response.Redirect in AJAX

I have a button in Update panel.

On button click I have written

Response.Redirect("InterMediateMsg.aspx", False)

When I executes the application I got the Error..

Sys.WebForms.PageRequestParserErrorException:The message received from the server could not be parsed.

How should I implement Redirection in AJAX.

Hi,

in the onclick (client side!!) you just place self.location.href='urltogoto'. Don't use AJAX for something like that but plain old javascript.

Grz, Kris.


Response.Redirect should work fine during an async postback. Try dropping the "False"... I'm not sure if you can use that option.


Actually I have performed server side coding( Database operations) on button click .

After the successful operation I want to navigate to another page.

How could I do it.


I have tried it by dropping false.

Actually this second parameter specifies whether I want to terminate execution of current page or not.

Is there any effect of browser.

I am using IE 6.0


Make sure that you have buffer set to false on the page from which you wish to redirect - otherwise output will already have been streamed out to the client, and things will go horribly wrong!

This cost me quite a bit of investigation a while ago..!


i think this error may be because it is trying to process a redirect within the update panel. assuming you use a trigger for the updatepanel and button, set it to a asp:PostBackTrigger instead of a asp:AsyncPostBackTrigger, this will send your page into a full postback, which may solve your problem (i haven't tested it).


I try the way you suggest, and its work !Wink


glad to help!Smile


Thnx ChrisCicc ,

It's working.

I have set the Trigger for button to PostBack and it worked.

0 件のコメント:

コメントを投稿