Wednesday, March 21, 2012

partial postback and FireFox

in FireFox, using javascript to call parent.__doPostback('mycontrol') seems to initiate the partial postback on the parent window, and you can see the UpdateProgress rotating Image, but it does not go away and the page never refreshes.

This works fine on IE and Opera - is this a known FireFox issue that the atlas team is working on?

Thanks in advance

hello.

any chance on providing a demo page that reproduces this problem?


Thanks for the reply Luis... unfortunately I don't have a demo page at hand, but will try to put one together if no-one else is already familiar with this particular issue.


hello.

well, you could also use fiddler to see what's getting passed from client to server and vice-versa...


FYI, this seems to have resolved itself with Beta 2

Correction, this still is not resolved - I was under the impression that it was fixed because calling __doPostBack with an eventtarget parameter that does not exist is causing a regular postback (a change from CTP)... you still cannot call __doPostBack() in hopes for a partial postback in FireFox.


I am having a similar problem as well. However i am initiating the partial page postback through a pop-up window. The pop-up window calls window.opener.__doPostBack(target, argument). The postback actually gets executed on the server, but the UpdatePanel on the underlying page does not get updated on FireFox. This works fine on IE.

Here is the source of a very simple page.

ASPX Page

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="sm1" runat="server" />
<asp:UpdatePanel id="updater" runat="server">
<ContentTemplate>
<asp:Label ID="serverTime" runat="server" /><br />
<asp:Button ID="getTime" Text="Get Server Time" runat="server" UseSubmitBehavior="false" OnClick="getTime_Click" /><br />
<a href="#" onclick="window.open('popupAjax.html','Popup','width=200,height=200');">Open Popup</a>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Code Behind

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;

public partialclass UpdatePanel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
serverTime.Text = DateTime.Now.ToLongTimeString();
}
protected void getTime_Click(object sender, EventArgs e)
{
Thread.Sleep(1000); // Used just to similate processing of something.
serverTime.Text = DateTime.Now.ToLongTimeString();
}
}

Simple Popup Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<a href="#" onclick="window.opener.__doPostBack('getTime','');window.close();">Update And Close Window</a>
</body>
</html>


In the example above I was using the latest ASP.NET AJAX Beta 2 build.

It seems you are having the same issue as I... the work-around we used for FireFox is to simply do a full postback - as follows:

if (opener.document.getElementById("__EVENTTARGET") !=null)

opener.document.getElementById("__EVENTTARGET").value ="XXXXXXXX";

if (opener.document.getElementById("__EVENTARGUMENT") !=null)

opener.document.getElementById("__EVENTARGUMENT").value ="";

opener.document.forms[0].submit();


hstechl:

It seems you are having the same issue as I... the work-around we used for FireFox is to simply do a full postback - as follows:

if (opener.document.getElementById("__EVENTTARGET") !=null)

opener.document.getElementById("__EVENTTARGET").value ="XXXXXXXX";

if (opener.document.getElementById("__EVENTARGUMENT") !=null)

opener.document.getElementById("__EVENTARGUMENT").value ="";

opener.document.forms[0].submit();

Where do you put this script ? In a client script block or ?


I would try the followings:

- I have problems in firefox 2.0 and ajax ctp/beta 1/beta 2 (rc1 not tested yet) when opening popups via javascript (strange javascipt errors, i have athread about it, but no response yet)

so instead of

<a href="#" onclick="window.open('popupAjax.html','Popup','width=200,height=200');">Open Popup</a>

try

<a target="_blank" href="popupAjax.html">Open Popup</a>

(I think this is better for the "modern" browsers, because you not force your user for a defined window size and the user could decide where to place our popups: in a new window?, in a new tab? However there is one drawback: you cannot close the popup by javascript without a security warningSmile )

- Maybe thedummy button trick is works for you (I am using it for ajax popups and parent update panels always). Not elegant but works.

No comments:

Post a Comment