views:

57

answers:

2

Is there any way to convert normal window to modal window?

I have a grid with a image column. As I click the image a window is appearing with the image.(using javascript window.open(...) )

But, as I click a different image in the grid a second window is appearing with respective image. I dont want the user to be able to do anything else before closing the current window.

+1  A: 

You can use

window.showModalDialog

Creates and displays a modal dialog box containing a specified HTML document.

Syntax

returnVal = window.showModalDialog(uri[, arguments][, options]);

returnVal is a variant, indicating the returnValue property as set by the window of the document specified by uri.

uri is the URI of the document to display in the dialog box.

arguments is an optional variant that contains values that should be passed to the dialog box

options an optional string that specifies window ornamentation for the dialog box, using one or more semicolon delimited values

rahul
A: 

Because it's pretty complicated to achieve that behavior to work cross-browser, I'd go for a JavaScript code that generates a similar behavior with div elements.

You can use 3rd party components for that (like DevExpress' AspxPopupControl) or free open-source components like JQuery UI dialog.

Shay Friedman