2012年3月26日月曜日

Response.Redirect on asynchronous postback issue with MasterPage

Hello,

So far Atlas seems to handle Response.Redirects correctly during asynchronous postbacks for me, but I have come accross an issue now (I'm using the April CTP):

I have an asp:Button on a MasterPage inside an atlas:UpdatePanel. When the button is clicked an asynchronous postback happens. On the server I handle the button click event and raise a public event called Update that I defined on the MasterPage. A content page using this MasterPage can attach a handler to this Update event in its Page Load event handler or OnLoad override (the content pages have the MasterType directive set so the event can be accessed through the Master property of the Page) and this handler on the content page can perform whatever updates it likes, like re-databind a GridView (this handler must then also invoke Update on the UpdatePanel containing the GridView). This works fine. But if a handler for this Update event in a content page invokes Response.Redirect, then I get problems. The redirect takes place, but when the new page loads it cannot access any if its Page properties like Request, Response, Session, Application, etc. They all give Null Reference exceptions. After this it seems like the web application has restarted.

So, I think this is an Atlas problem. Whereas Atlas handles Response.Redirects ok during asynchronous postbacks when invoked in a handler on the server of a control event where the handler and control are in the same page, it seems to have a problem when invoked in a method on a content page where the asynchronous postback was initiated by a control in a masterpage. Can anybody in the Atlas development team comment on this and reproduce it and suggest a fix?

I can post a code sample if my explanation is not clear.

If you're wondering why a have this button in a master page that can trigger updates in its content pages, that's because I have a web application where I have one main window from where other pages can be opened in new windows. Any of these newly opened windows must be able to trigger an update in the main window. They can do this programmatically using clientside javascript by calling the click method on the button that is part of the master page in the main window where the main window can be accessed from the newly opened window through the window.opener property. Hope this clarifies what I'm trying to achieve: basically a cross-window trigger for update panels.

kind regards,


Remco

please ignore my post. The target page of the Response.Redirect did not work because I had passed it an incorrect url. The url was something like ~/page.aspx??var=value. It didn't like the double ??. I don't blame it. So no Atlas related issue at all. My fault.

Remco

0 件のコメント:

コメントを投稿