How do I get my page to maximize when it opens?

Hi,

I'm using Visual Studio ASP.NET 2005.  How do I get my page to maximize when it opens?

Thanks,
Denise
DeniseGoodheartAsked:
Who is Participating?
 
bsdotnetCommented:
Add this in your page_load, (modified based on bullrout's comments)
        Dim cscript = ""
        cscript = "<script language=JavaScript>window.moveTo(0,0);window.resizeTo(screen.availWidth,screen.availHeight);</script>"
        ClientScript.RegisterClientScriptBlock(Me.GetType(), "cscript", cscript)
0
 
asdaveyCommented:
Do you mean how do you get the browser to maxmize when someone visits your site?
0
 
bullroutCommented:
Hi There,

If you are talking about a window then you could use something like this.

in the body using onload you can call a function:

<BODY  onload="MaxWindow ();" >

then in the head of the document you can place the javascript function itself:

<SCRIPT language="JavaScript">
      function MaxWindow ()
      {
        window.resizeTo(screen.availWidth,screen.availHeight);
        window.moveTo(0,0);
      }
</SCRIPT>

This will allow the window to maximise when opening. Hope this helps

Sean


0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
DeniseGoodheartAuthor Commented:
Hi,

I would like to use VB.NET in the ASP.NET Page_Load event to have the page appear as maximize.

Thanks,
Denise
0
 
bullroutCommented:
You want the window to maximise when loaded, is that correct?
0
 
asdaveyCommented:
The page can't be maximised using VB.Net because VB.Net executes on the server side. The maximisation has to occur on the client side, so javascript is your best answer.
0
 
bullroutCommented:
hi,

use the RegisterStartupScript method to place the code inside the Page_Load event.

Sean

0
 
irps20001Commented:
Write a javascript function and run that funciton on load.

Your aspx page
[CODE]

function maximizeWindow() {
      window.moveTo(0,0);
      window.resizeTo(screen.width,screen.height);
}


      <body leftMargin="0" topMargin="0" onload="maximizeWindow();" marginwidth="0" marginheight="0">
[/CODE]

Code is similar to what bullrout is given above, i just added window.moveTo(0,0);
Rest are all same except screen.availWidth,screen.availHeight.
Credit goes to bullrout

0
 
DeniseGoodheartAuthor Commented:
Hi All,

I learned a lot  with all your great help.

Many Thanks,
Denise
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.