Open WebForm to size from code behind

  • Thread starter Thread starter mg
  • Start date Start date
M

mg

window.open (URLTarget, windowName,
height=720,width=975,resizable=yes, ...

lets me open a new WebForm with a specified size using
JavaScript.

Is there a way of doing this from code behind; something
like

if (rbX.Checked == true)
{
Server.Transfer("Page2.aspx" ...
}

where I can use logic involving WebForm components.

(Or, using the page properties in Visual Studio .NET)
 
You can't spawn a new browser window or resize the user's browser on the
client side using server side script - you're going to have to emit client
side script to do this.
 
There aren't any server side code that will help you
control the size of a client side browser window. Atleast
not that I'm familiar with.

But you can force feed client side javascript code thru
you server side code.

Try the following.

On Page load event of your page(page/window that you want
to resize) before postback put this in,

Page.RegisterStartupScript("", <script
language=javascript>window.resizeTo(300, 200);</script>);

HTH,
Suresh.
 
Back
Top