ShowModalDialog title disappearing after postback - javascript

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()

Related

onbeforeunload change the UI of dialog box or use custom

I have a page where if user click anywhere outside form or try to close the tab a dialog box/popup should come like your changes will be discard or do you want to move.
I can do this from window.onbeforeunload event but the problem is that i need to use a customized pretty dialog box instead of default one if any alternate approach is there.
If we use any modal dialog box but i don't know which event to call on that dialog also tried window.onload but it not fulfill my problem as i need to ask the viewer before moving to other page.

Dialog box minimizes on clicking elsewhere in the main window

I'm using
dialog.showMessageBox([browserWindow, ]options[, callback])
to confirm a delete operation.I expect the user to close the dialog box first in order to perform some other operations.However, when the dialog box pops up the user is still able to click other parts of the window and on doing so the dialog box minimizes automatically.
Is there a way to restrict a user not to do anything else unless the dialog box is closed ?
Note: On Atom Editor do the following:
File -> Open File , this results in a dialog box for opening a file and while this dialog box is opened, the user is not able to click on anything on the main screen. This is the same behavior I'm looking at.
Check out this feature that was recently added: https://github.com/electron/electron/pull/6140

Can a Google Chrome Extension popup window remain open as a new window is opened on top of it and then closed?

I have a Google Chrome Extension that uses the Background.html and background.js files to show this popup window when the chrome extension icon in the tray menu is clicked on....
Inside my popup is a button to generate a screenshot image of the current tab URL and it then uploads the image to my server and fills in the text input with the URL of my image upload.
I am now wanting to add the capability to select a region on the webpage screen and generate a screenshot image cropped to be just the content inside the selected region like this image below shows the region selected on the page....
My roblem now is that I cannot simply have a button in my popup take me into region selection mode on the page. I could but it would close the popup window and I have researched and found out that you cannot programtically open the popup.
So once the popup would close, I would no longer be able to edit the record loaded in it before.
I am trying to come up with a new solution to achieve my desired result.
Idea 1
Move all the functionality that my current background popup has into a modal window displayed on the actual webpage.
This would be a big change as it would require a lot of message passing as the modal code would not have access to theextension API which is used to generate the screenshot and get all the tabs data.
I could then open a modal that looks like my popup in the image above when the extension icon is clicked on.
When the generate screenshot button is clicked it would then send a message to the background script to get the tab API and generate the screenshot and then send it back as a message to the content script in the page.
As for my new feature of selecting a region and creating image of that region. The modal would have a button to do that and on click would hide the modal window. Next it would let me make the selection which on edn would send a message to background again and generate a screenshot and crop it to the coordinates of my selection and return it back in a return message to the content script which would then show the hidden modal window and update the image inside to show the new image.
This is the hardest way bu the best I think.
Idea 2)
If it is possibble even, on a button click inside my current popup would then launch a new popup window of the current page and allow me to make my selection region and generate the image which on completion would close the popup window and send the result back to my extension popup.
I do not know if this would work because I am unsure if the extension popup would auto-close when I click the new popup window?
Does anyone know of other way to accomplish this or if my ideas would be practical?
You can look at Adblock Plus for inspiration.
They have a popup with "Block Element" button that switches to "now interact with the page" mode.
After the user clicks, they open follow-up UI injected into the page.
In any case, clicking outside the popup will make it lose focus, which closes it by design.
You could instruct the user to click your button again after they interact with the page, or you would need to inject some UI into the page itself.

jquery dialog's input fields freezes in firefox

I have some jquery dialogs added in my application where in one scenario I open up a 1st dialog and upon entries into some field I am prompted with a message containing some server side messages and that prompt is again a 2nd jquery dialog. that means i have 2 dialogs opened over each other. so when i click on the top most(2nd) dialog then both the dialogs' $('#div1').dialog('close') and $('#div2').dialog('close') are called I am redirected to another page. Now here is what the issue arises, I am on new page with both dialogs closed, now if I open up the 1st dialog again it opens up but with everything frozen. I mean it literally takes no input but a cursor keeps blinking in first field. This happens only in Firefox, in Chrome it works like a charm.

How to get jquery to reuse element identities re-loaded via AJAX correctly?

I'm not sure I've diagnosed this problem correctly.
I have a jquery dialogue that pops up another jquery dialog. When I pop up the inner dialog
once everything seems to work. when I close both dialogues and reopen them the "save" button on the
inner dialogue does not work right -- in particular it doesn't close the dialog.
What I think is happening: The second time the content for the second dialogue is reloaded
via AJAX using the same DOM id's as the first time, and when jquery tries to close the dialogue
it tries to close the "old" dialogue which no longer exists (or at least is not visible).
Am I right? If so how to get jquery to forget the old element and use the new one?
If you want to see the problem yourself:
go to http://ibidreview.appspot.com/Teach/Edit?eid=1DemoE&owner=
click the first "change question" button. First dialog should show.
click the "html" pseudo-link. Second dialog should show.
click "save" on inner dialog. Inner dialog should close
click "change" on first dialog. First dialog should close.
Now repeat steps 2,3,4 and notice that on step 4 the inner dialog does not close.
I will stop trying to fix this for a while so the steps will work the same... Thanks in advance!
Take a look at the live() event handler. This will ensure that the element will still fire the event after being destroyed or recreated. http://api.jquery.com/live/
Use something like this:
$(button).live('click', function() {
$(form).save(); //save the form
$(menu).close(); //close the menu
});

Categories