Resizing windows

If you have a lot of data on an entity form, then you sometimes do want to force the page to open in full screen mode. There's a small javascript which will allow you to do this. Just add these two lines of code to the form onload of your entity form:


window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);

Also, when you open a custom page you can also set the window size by using the same javascript function. In your code you can use the following function in the Page.OnLoad() to set the window size to match your requirements:

private void SetWindowSize(int iWidth, int iHeight)
{
StringBuilder sbResizeScript = new StringBuilder();
sbResizeScript.Append("\n");
ClientScript.RegisterClientScriptBlock(this.GetType(), "ResizeScript", sbResizeScript.ToString());
}


Happy resizing!

3 comments:

Anonymous said...

ping back from http://www.castorsoft.com/articles/2008.3.19.htm

raggers said...

Hi,
Thanks for the script.It helped us to resize the window .Great , keep it up

Unknown said...

This is not working from outlook client.