: : : I hope this is an easy question. I'm writing a web application and when a user clicks a button, a small pop-up window needs to open with various input controls.
: : :
: : : How do I set the size and position of this aspx form when it opens so that it is small and in the middle of the screen?
: : :
: : : Thanks
: : :
: : You can only control the window size when the url is opened from the client through a clientside script block. You could do something tricky like doing a redirect with window.open and then closing the first window with window.close. Then only one window will be open and you will have opened a new window so you can set the size. I don't remember the syntax but that's generally how you do it.
: :
: : -Ray
: :
:
: You need client-side code to pop open another browser window. However, you can use server-side code to dynamically add the size constraints to the client-side code:
:
:
: <script language="javascript">
: function openWindow()
: {
: var wnd = window.open(
: 'somePage.aspx?id=<% =id %>',
: 'Page Title',
: 'width=<% =width %>,height=<% =height %>');
:
: return false;
: }
: </script>
:
:
: Then you can call the javascript function in an onclick handler for a button for instance ...
:
:
: <input type="button" onclick="return openWindow();">
:
:
:
I bow to thee Oh Great Gurus IWillDoIt and Raymcd. You've given me the exact concepts and code snippet I need.
Thank you so much.
James