Sunday, March 11, 2012

Ajax 10/20 version: Redirect doesnt work when using AsyncPostBackTrigger on UpdatePanel

One thing to keep in mind is that the any controls within an Update Panel are automatically considered "triggers" when mode is conditional - in other words - depending on the mode:

Mode= Always will always send back everything everthing in the UpdatePanel and IsAsynchronous value will always be false. Normal postback (just not full page just whats in the UpdatePanel.

Mode = Conditional - IsAsynchronous will be true and captured. Allowing for the ability to process an Asynch process...

Triggers are useful for stuff outside the panel or needing to update other panels (little sketchy on that - but the documentation site has some GREAT examples... But if all the stuff you are trying to trigger and update can be contained ... you can work around the redirect issue... may or may not be what you are looking for but just thought I would post on that if you haven't thought of it. I think I am fairly accurate on this as I use a gridview in a modal... I don't do redirections based on it but ...I have found very little purpose in Triggers where all of the controls that need to trigger updates is contained within the panel...


Thanx!

I do use external triggers and I have not been able to have the sorting of the grid work without triggers when the updatemode is conditional...

It sorts but refreshes the whole page everytime...


Can you post your code-behind... I program C# but have no problems inside an update panel with events contained within an update panel,,,, I do have blog entries on the links on my singnature...

If you read some of the articles - and have subesquent questions - either here or there... Alot of it all has to where in the page cycle you handle things...it is one of the most confusing things about Ajax and I have to presume some of the more enxtended issues I have deals explicitly with where in the page cycle I handle events... but for the update panel with gridview I can successfully handle paging, sorting, etc without any major workarounds..


Hi!

I replaced the buttons in the rows by hyperlinks. I build the NavigateUrl when the grid rows are created, that works.

I still have the problem of the updatepanel not working when sorting.

It sorts but it refreshes the whole page instead of just the panel.

See:http://forums.asp.net/thread/1442918.aspx I put some code there.

Thanx!


I found another post from today talking about the same problem with buttons in UpdatePanels (error when redirect).

It seems the answer is to add the following in web.config:

<httpModules>

<addname="ScriptModule"type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</httpModules>

No comments:

Post a Comment