views:

1438

answers:

1

Hola,

I'm trying to resize my modal dialog window when certain items are hidden/shown.

window.resizeTo(800, 600);

I've tried using code like above, but it doesn't seem to work. I think because it is a modal dialog, and not a regular window. Any suggestions as to how I could resize this?

+2  A: 

You'll want to identify the element or container ID and do something like this:

document.getElementById('MyModal').style.height = '500px';
document.getElementById('MyModal').style.width = '800px';

If you are using jQuery for this it can be quite a bit easier as you can attach it to the actual show modal function.

Edit
Within the javascript functions above, MyModal will be the ID of the container or modal. For example, if you are using a DIV for the outer element of your modal, you would set the DIV up like this:

<div id='MyModal' class="IFNEEDED">CONTENTS OF MODEL</div>

EDIT #2
Since this is not a "modal" as most would describe today, its more of a new window popup, this line of code should work for you (found it here):

window.open('http://www.pageresource.com/jscript/jex5.htm','mywindow','width=400,height=200')
RSolberg
This looks like exactly what I need. However, where on the page would 'MyModal' be set?
matthew_360
I've added some info above.
RSolberg
Thanks R, but I think that maybe I'm not describing my scenario completely. I open the modal using showModalDialog, and it opens up a different aspx page in that dialog. I've tried accessing it via Page Title and a couple other things, but that hasn't seemed to work. Thanks for the help!
matthew_360
When you say "modal" is it a layer being added to the current webpage, or are you literally just opening a new webpage all together? Is this like a popup window?
RSolberg
it is a pop-up. A different page from the same website is brought up in a modal dialog to act as a form for editing values displayed in a gridview on the parent page.
matthew_360
I've added a bit more info. Let me know if that helps at all.
RSolberg