|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Hi, I am having an issue with Firefox and the callback panel since I installed your latest version. In our code, we sometimes make a call to eo_Callback on page load. This is so that we can display the 'loading dialog' and provide the user with feedback while the page performs lengthy initialisation. This has always worked fine for IE and FF. However, since installing your latest version, we are finding that the callback is not occuring for FF.
Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IIPay.Web.WebForm1" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<eo:CallbackPanel ID="callbackMain" runat="server" LoadingDialogID="dlgLoading">
<asp:Label ID="lblStatus" runat="server" />
</eo:CallbackPanel>
<eo:Dialog runat="server" ID="dlgLoading" BackShadeColor="Blue">
<ContentTemplate>
<table border="0">
<tr>
<td align="center">
<img src="Images/loading.gif" />
</td>
</tr>
<tr>
<td>
Please wait...
</td>
</tr>
</table>
</ContentTemplate>
</eo:Dialog>
</form>
</body>
</html>
Code: C#
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
lblStatus.Text = "Before Callback...";
string loadScript = string.Format("eo_Callback('{0}', 'loading');", callbackMain.ClientID);
Common.SetLoadScript(this, "initialise", loadScript);
}
// is this a callback...?
if(!string.IsNullOrEmpty(Request.Form["eo_cb_id"]))
{
// lengthy initialisation
Thread.Sleep(2000);
lblStatus.Text = "After Callback...";
}
}
Regards Phil
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I am not sure how your Common.SetLoadScript works. However it is possible that the controls are not loaded even after the page is loaded. To run the code after the control is loaded, you can handle the controls' ClientSideOnLoad event.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Thanks for the reply. I have tried using ClientSideOnLoad, but this has not fixed the issue. I may be misunderstanding your solution, and so have included my latest code in this post. I am finding now that IE still works (but does not display the loading dialog), and FF still does not invoke the callback. [Apologies for including one of my own library functions in the last post. Common.SetLoadScript simply calls ClientScriptManager.RegisterStartupScript]
Code: HTML/ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IIPay.Web.WebForm1" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<!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 id="Head1" runat="server">
<title></title>
</head>
<body>
<script language="javascript" type="text/javascript">
function callBackPage(sender) {
eo_Callback('callbackMain');
}
</script>
<form id="form1" runat="server">
<eo:CallbackPanel ID="callbackMain" runat="server" LoadingDialogID="dlgLoading">
<asp:Label ID="lblStatus" runat="server" />
</eo:CallbackPanel>
<eo:Dialog runat="server" ID="dlgLoading" BackShadeColor="Blue">
<ContentTemplate>
<table style="border:solid 1px black; background-color:silver" >
<tr>
<td align="center">
<img src="Images/loading.gif" />
</td>
</tr>
<tr>
<td>
Please wait...
</td>
</tr>
</table>
</ContentTemplate>
</eo:Dialog>
</form>
</body>
</html>
Code: C#
public partial class WebForm1 : Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
callbackMain.ClientSideOnLoad = "callBackPage";
// uninitialised
lblStatus.Text = "Before Callback...";
}
// is this a callback...?
if (!string.IsNullOrEmpty(Request.Form["eo_cb_id"]))
{
callbackMain.ClientSideOnLoad = "";
// lengthy initialisation
Thread.Sleep(2000);
lblStatus.Text = "After Callback...";
}
}
}
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Try the following code:
Code: JavaScript
function callBackPage(sender)
{
var dlg = eo_GetObject("dlgLoading");
if (!dlg || !dlg.isLoaded() || !eo_Callback('callbackMain'))
setTimeout("callBackPage()", 100);
}
This should get you going. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 8/24/2007 Posts: 130
|
Thanks, that has solved the issue.
Would it be possible for you to give me some brief background as to why this issue occured in the latest release. A large number of our users use Firefox, and I am a little concerned that this issue could manifest elsewhere.
Thank you.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The reason is in the latest version it does not send CallbackPanel to the server unless the page is fully loaded (The check is only performed on FF because this is only an issue on FF). If you try to call eo_Callback before page loads, it will fail. So you need to check eo_Callback's return value to determine whether it has succeeded.
Thanks
|
|