views:

497

answers:

4

How can I Open and Close Popup windows without Javascript in ASP.NET?

+4  A: 

What do you mean "Popup windows".

JavaScript allows you to manipulate the properties of a window object allowing you to remove the status bar, address bar, set the size and position of the new window and other things.

The only other way (short of using VB script :) is to have links with target set to _blank. But then you can't customise the new window.

Greg B
Yeap- just bear in mind _blank isn't valid with XHTML strict.
RichardOD
+1  A: 

You can't.

Opening and closing popups implies javascript code execution on the client side.

You could eventually create an ASP.Net panel that looks like a popup and set it visible/invisible during the postback but it won't behave like a 'real' popup (you won't be able to move it for example).

Olivier PAYEN
A: 

The best way to display popup window without javascript is to use ModalPopup control. It is available in the AjaxToolKit. Refer following link: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx

Regards, Avi http://www.etechplanet.com

Technology Professional
Although the "J" in AJAX stands for "JavaScript", and this would still be using JavaScript to show the modal popup.
Zhaph - Ben Duguid
A: 

Hey Ortus,

Unless otherwise but I conquer with @Olivier that you can't do that without using Javascript. Even with the solution given by @Avi, you are still using Javascript though it is kinda abstracted from you.

Maybe, you could explain why you don't want to use javascript because even without the AjaxControl, it is kinda pretty easy to open and specify other properties of pop up windows.

Matrich