Open WebForm to size from code behind

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)
 
C

Chris Jackson

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.
 
S

Suresh

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top