Hi all! I have a jquery dialog and when I open and close it, go to another page, and after that, go back with the browser go back button, the dialog is showed again. This is happening in Chrome and IE and not in Firefox. What can I modified of the dialog?
Thanks!
Hi Patrik, I did the cleaning and Ctrl+F5 and still with the problem. When I do the cache refresh it show me the dialog again, in all browsers, I don't know if this should be the normal behaviour.
Hi Patrick! Thanks for the reply, if I add it in document ready, the page doesn't show any data, and if added in document load, it has the same behaviour like before. Which relevant code do you think I should post?
function OpenApprovalDialog() {
if ($('#<%= hdnOpenDialog.ClientID %>').val() == 'Y') {
alert(document.getElementById('<%= hdnOpenDialog.ClientID %>').value);
document.getElementById('<%= hdnOpenDialog.ClientID %>').value = 'N';
alert(document.getElementById('<%= hdnOpenDialog.ClientID %>').value);
$.blockUI({ message: $('#approval-form'), baseZ: 10000 });
/*Add the dialog form to the main in order to call server side methods*/
$('#approval-form').parent().appendTo($("form:first"));
return false;
}
The message box are correct, because the seconde message is "N", but when I go back with the browser for test if my problem is resolved, it seems like the "if" checking is not working, because is showing me the two messages again. It is not execute any code
in the server side because doesn't stop in any break point I have. What's wrong here?
Now, trying with a session variable, I'm doing a call from javascript to the server side, where I change the Session variable, but I saw that the javascript is not taking the new value:
jorge_sr
Member
4 Points
34 Posts
jQuery dialog opens when go back in browser
Dec 11, 2012 11:10 AM|LINK
Hi all! I have a jquery dialog and when I open and close it, go to another page, and after that, go back with the browser go back button, the dialog is showed again. This is happening in Chrome and IE and not in Firefox. What can I modified of the dialog? Thanks!
function OpenApprovalDialog() { $.blockUI({ message: $('#approval-form'), baseZ: 10000 }); $('#approval-form').parent().appendTo($("form:first")); return false; };$('#btnCancelApprove').click(function () { $.unblockUI(); $("#approval-form").parent().detach(); return false; });pratik_galor...
Participant
1483 Points
330 Posts
Re: jQuery dialog opens when go back in browser
Dec 11, 2012 11:21 AM|LINK
If it is working properly in firefox then clear all your browser history and cache in chrome and IE..press Ctrl+F5 several times and then check.
Software Engineer,
iGATE Global Solutions.
pratik_galoria@yahoo.co.in
+91-8905195943
jorge_sr
Member
4 Points
34 Posts
Re: jQuery dialog opens when go back in browser
Dec 11, 2012 11:34 AM|LINK
Hi Patrik, I did the cleaning and Ctrl+F5 and still with the problem. When I do the cache refresh it show me the dialog again, in all browsers, I don't know if this should be the normal behaviour.
pratik_galor...
Participant
1483 Points
330 Posts
Re: jQuery dialog opens when go back in browser
Dec 11, 2012 11:36 AM|LINK
It should not be a normal behavior,
need to check your complete code, but temporarily you can use this code and call it on body onload() or $(document).ready() functions,
$("#approval-form").parent().detach();Software Engineer,
iGATE Global Solutions.
pratik_galoria@yahoo.co.in
+91-8905195943
jorge_sr
Member
4 Points
34 Posts
Re: jQuery dialog opens when go back in browser
Dec 11, 2012 03:28 PM|LINK
Hi Patrick! Thanks for the reply, if I add it in document ready, the page doesn't show any data, and if added in document load, it has the same behaviour like before. Which relevant code do you think I should post?
jorge_sr
Member
4 Points
34 Posts
Re: jQuery dialog opens when go back in browser
Dec 12, 2012 09:15 AM|LINK
Hi! I open the dialog from an event in the server side, called from the client side like this:
<td class ="approval-img"><asp:ImageButton runat="server" CommandArgument = '<%# Eval("aux_approvalId")%>' OnClick="getApprovalID_approve" ToolTip="Approve" ImageUrl="/Images/Approve.png" /></td>Ans this is my dialog code:
<div id="approval-form" style="display: none; cursor: default" title="Approve"> <div class="approve-change"> <ul> <li> <p><label>Approve change: </label><label>Reason</label></p> <textarea id="txtReasonApprove" runat="server" cols="1" rows="1" class="required"></textarea><br /> </li> <li> <span> <button id="btnCancelApprove" class="blue-problem">Cancel</button> <asp:Button ID="btnApprove" runat="server" CssClass="blue-problem" Text="Approve" ToolTip = "Approve" OnClick="ApproveChange_Click"/> </span> </li> </ul> </div> </div>asteranup
All-Star
30184 Points
4906 Posts
Re: jQuery dialog opens when go back in browser
Dec 12, 2012 10:06 AM|LINK
Hi,
Are you trying to open the dialog only once? If so, save some status in session and check the session and show the dialog. Try this-
if (Session["openedonce"] == null) { string script = "OpenApprovalDialog();"; Page.ClientScript.RegisterStartupScript(typeof(Page), "", script, true); Session["openedonce"] = true; }Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
jorge_sr
Member
4 Points
34 Posts
Re: jQuery dialog opens when go back in browser
Dec 12, 2012 10:13 AM|LINK
Hello! No, I open the dialog any time I click the ImageButton, so I can't count it! Thaks for the reply!
jorge_sr
Member
4 Points
34 Posts
Re: jQuery dialog opens when go back in browser
Dec 13, 2012 09:28 AM|LINK
Hi, working on it I have decided to set up a hidden value:
protected void getApprovalID_approve(object sender, EventArgs e) { hdnOpenDialog.Value = "Y"; string script = "OpenApprovalDialog();"; Page.ClientScript.RegisterStartupScript(typeof(Page), "", script, true); }And this in the client side:
function OpenApprovalDialog() { if ($('#<%= hdnOpenDialog.ClientID %>').val() == 'Y') { alert(document.getElementById('<%= hdnOpenDialog.ClientID %>').value); document.getElementById('<%= hdnOpenDialog.ClientID %>').value = 'N'; alert(document.getElementById('<%= hdnOpenDialog.ClientID %>').value); $.blockUI({ message: $('#approval-form'), baseZ: 10000 }); /*Add the dialog form to the main in order to call server side methods*/ $('#approval-form').parent().appendTo($("form:first")); return false; }The message box are correct, because the seconde message is "N", but when I go back with the browser for test if my problem is resolved, it seems like the "if" checking is not working, because is showing me the two messages again. It is not execute any code in the server side because doesn't stop in any break point I have. What's wrong here?
jorge_sr
Member
4 Points
34 Posts
Re: jQuery dialog opens when go back in browser
Dec 14, 2012 11:10 AM|LINK
Now, trying with a session variable, I'm doing a call from javascript to the server side, where I change the Session variable, but I saw that the javascript is not taking the new value:
if ('<%= Session["OpenDialog"] %>' == 0) { $.blockUI({ message: $('#approval-form'), baseZ: 10000 }); $('#approval-form').parent().appendTo($("form:first")); PageMethods.ReassignTeamAdded(); return false; }[WebMethod] public static void ReassignTeamAdded() { HttpContext.Current.Session["OpenDialog"] = "1"; }Someone could give some good idea on how to resolve this? Thnaks!