Resize a webform automatically

When designing a workflow in Captaris Workflow, one of your options is to use WebForms for all the UI. When doing this, we will usually open the form to some less than useful size and the enduser will usually resize the form to be able to use it. Resizing the form automatically is easy enough to do, but I always forget what the JavaScript should look like to do that. So here it is…just stick this in the PageLoad method and set the size to the right size for that form. Easy… Hopefully next time I need it, I won’t have to search for 10 minutes for this no-brainer…

Page.RegisterClientScriptBlock("tpCustomScript",
    "<script language=JavaScript>function resize()
    {window.resizeTo(300,300);};window.onresize=resize;
    resize();</script>");