i have a aspx page which i am loading using facebox. In the form i have a button which submits the form.on clicking the button the facebox closes and browser shows the same form which was opened in facebok.
I used asp.net update panel to avoid full postback in popup, but using update panel not showing the facebox popup.
how can i make the facebox popup windows stayed there as it was before postback.
How is the facebox code being bound to the button? Now that the button is wrapped in an update panel, you may have to wait until after the update panel loads to bind.
You can put your js code in this event, and it will run each time an update panel ajax call finishes.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(bindButton())
Related
A page includes a 'wait pictogram' that appears whenever a user action triggers an AJAX request. To do that, script FoxInCloud.js > FoxInCloud.WaitPic() sets it to z-order:10000; and removes display:none;
Pictogram appears fine when user action occurs on the main page;
It fails to appear when user action takes place on a Bootstrap modal opened 'over' the main page.
It does appear over the modal when removing the display:none; attribute manually using the browser developer tool.
What happens here?
Thanks,
Test page
Video showing the behavior
Bootstrap 3.3.7
So, what I have is a lot of pages like this, with GET parameters: benchmark.php?game_id=87
that display the information about the particular game (info is in a database) and also contains an Edit button.
The Edit button opens a new window using JS window.open("edit_game.php?game_id=87",...)
The Edit window contains a few textboxes to add/modify data and a Save button.
The desired behaviour here is that when I press the Save button on the edit_game.php page, not only that the information is saved in the DB (this works) but also the benchmark.php?game_id=87 page is maybe refreshed so that the information displayed is actual. I don't know how to do the 'submit on page x, page y is aware and refreshes'.
I assume I should use AJAX for this but I don't know where to start. What I tried is something like this
setInterval( function(){
$('#refresh_station').load('game_information.php');
}, 2000);
that every 2 seconds it refreshes the information present in benchmark.php?game_id=87 but I find this very inefficient since it refreshes the info even if no modifications happened.
Is this the only way to approach this situation?
Edit: I should mention that edit_game.php?game_id=87 is not supposed to close or anything after pressing Save. So I can't just use the submit form to redirect back to benchmark.php.
Yes you should use Ajax for it also add one field in Database table last_update, now when page edit_game.php?game_id=87 load it have last_update time, ajax check this last update on some interval time if ajax see there is any update page should be refreshed.
Running a loop that checks every few seconds whether the records have changed isn't the best solution in my opinion. There's a much easier way to trigger a page refresh when you submit a form in a popup window.
Using window.opener you can perform actions on the window that opened the popup that you're currently in. In your case:
<form onsubmit="window.opener.location.reload();">
Your form here.
<input type="submit" value="Save changes">
</form>
Or in jQuery:
$('form').submit(function() {
window.opener.location.reload();
});
https://jsfiddle.net/yqv1eh8w/1/
postMessage
can communicate with the child window. Link
window.addEventListener("message", function (event) {});
will let you listen to it from a child window.
This should be help you with what you want.
The entire thing communicates with the help of events and messages.
Also, you will need to run this locally (coz I opened popups to the same window)
IMO, the best approach is to use a popup form. If your web page is already using Bootstrap, you can add a modal popup easily with the edit form as it's content. When clicking on the edit button, instead of opening a new window, you can open this popup.
Then submit this form with ajax on click of the submit button and inside the Ajax success function, add javascript/jQuery to close the modal and refresh the page content.
I am trying to implement multiple level of jQuery Dialog with modal behavior. I have main page which open up first dialog box from where second dialog box can be open all both should be modal box.
First issue is I am getting error on fiddle when clicking main page link and second its not creating dialog as required.
Fiddle
A bunch of things going on:
In the jsFiddle, you need to add jQuery UI and a theme as external resources. Selecting just the jQuery library is not enough. jQuery UI Dialog is part of the jQuery UI library, not part of the jQuery core library.
Since your click events are on <a> tags, you need to cancel their default behaviour. Make a click handler for your <a> tags, and cancel the default behaviour first before doing anything else:
Gold
$("#clickForGold").on("click", function(e) {
e.preventDefault(); <--- this stops the link from navigating
//now do other stuff
});
Set up your dialogs at page load, and then open them when you need to. Use the autoOpen:false parameter to keep them from opening when the page loads. Open them as follows:
$("dialog-id").dialog("open");
Don't open a modal over a modal. It's extremely poor for usability. Close the first one before opening the second one:
function clickForSecond() {
$("dialog-id-first").dialog("close");
$("dialog-id-second").dialog("open");
}
A working example:
https://jsfiddle.net/5ucat3f7/1/
In my asp.net application, page is refreshing specific time using Response.AddHeader("Refresh","30"), but if i open pop up(window.open) case also Page is refreshing then pop up closing. How to stop the refresh in parent page when Popup opens.
I tried with another code.Added below code in window,onload event.
setTimeout(function(){window.location.reload()},30000)
How to increase refresh time when we open popup(window.open).
Thanks.
The following code at the bottom of the page is what you need.
setTimeout(function(){window.location.reload()},30000)
this post is similar to another one I posted previously but the suggested answer didn't work :(
I am spawning a new dialog window through showmodaldialog. The title is set in the tags of the aspx page. When the dialog is created and shown, the title of the dialog box is correctly set. However anytime I do a postback on the page (e.g select a value from a drop down box, select a row in a gridview) the title disappears leaving just --WebPage Dialog.
I have tried to re-set the dialog title using document.title via javascript and also Page.Title via vb.net but no joy. Everytime a postback occurs, the dialog title is lost. This does not happen in any of my other showmodaldialog windows in my application.
The only difference between them and this dialog window is that this is a dialog window opening from within another dialog window (i.e. 2 dialog windows open - the first window, when a link is clicked, it opens this second dialog window where the title disappears upon postback).
Can anyone suggest what the problem is?
Thanks,
C
May be you might assign the title after the showdialog() method.
you have to set the title before the showdialog()