Link to home
Start Free TrialLog in
Avatar of fmichail
fmichailFlag for Canada

asked on

How to open my webform maximized

when I open the first webform in my web site it opens in a reduced form.how can i open it maximized automatically. please send me the code in VB.NET
Thanks
Avatar of riyasjef
riyasjef

Just insert this script in your aspx file...

<script language="JavaScript1.2">
top.window.moveTo(0,0);
if (document.all)
   { top.window.resizeTo(screen.availWidth,screen.availHeight); }
else if
   (document.layers || document.getElementById)
   {
   if
    (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth)
     { top.window.outerHeight = top.screen.availHeight;
       top.window.outerWidth = top.screen.availWidth; }
   }
</script>

RJ
u cannot open a webform in a maximized format .. there is no such property for a window or a document ... the above code will still keep it in the normal form, but exapnd it to so that it uses the available space in the screen and makes it look as if it has been maximised ... BTW, The IE browser retains the last position and state of the browser when it last used .. so if ur last browser's winsdow state was maximised, then the next session would also be maximised ... so it seems that the problem you are facing might be because you are using window.open in ur first page to open another window ... if thats the case .. then u could use the features to assign the property to the new window

window.open newPage.aspx, "Left=0,Top = 0, status=no, menu=no, location=no, resizable=yes, titlebar=no, toolbar=no,height=" & screen.availheight & ",width=" & screen.availwidth

Avatar of fmichail

ASKER

I start the project by an empty form used mainly to initialize variables then silently issues a command
request.redirect("myfirstPage.aspx")

this first page starts in a small form, and accordingly all the pages of the site will be within the same browser window.
The problem is how to run the project to display the first page (and accordingly the rest ofthe site) in full size.
Please, send me any server code in VB.net, otherwise Javascript for client side.
regards
>>I start the project by an empty form ..
is this maximized?
is ur browser IE? as i said .. it retains the size it was last closed in .. open a browser .. maximize it and then close it .. then all the latter browser windows opened will be in the mximized state .. there is no server side code for maximizing the broswer window .. use the javascript provided above to expand the browser window to the max available size in the screen (but not maximized)
@Rejojohny

>> use the javascript provided above to expand the browser window to the max available size in the screen

This is what..actually happening when we maximize a window manually..right?
 
@fmichail

>>The problem is how to run the project to display the first page (and accordingly the rest ofthe site) in full size.

What u meant by "full size"?
Is it this  "status=no, menu=no, location=no, resizable=no, titlebar=no, toolbar=no,height=..." ?
If so ..impossible...
U can postion the first window..alss resize the window..but u can't hide the toolbars or menubars..
this is possible with "popup window" only..
>>This is what..actually happening when we maximize a window manually..right?
No .. maximized is a state in which the window is .. that is when we click on the maximize button of the window .. the one left to the close button ("X") .. i think that is what the author means ..
fmichail,
what u could do is .. instead of a redirect .. in the first page .. write this piece of code after all ur initial processing ...in the page load.. it will open a new window in expaded mode and close the first page ...

in the .vb file .. code-behind .. page load
dim lstrScript as string = "<script language = javascript>" & vbcrlf
lstrScript += "OpenNewForm();" & vbcrlf
lstrScript += "</script>;" & vbcrlf
page.RegisterStartupScript("OpenForm", lstrScript)

and in the aspx page .. deifne the function
<script language = javascript>
var screenheight = screen.availheight;
var screenWidth = screen.availwidth;
window.open(newPage.aspx, "Left=0,Top = 0, status=no, menu=no, location=no, resizable=yes, titlebar=no, toolbar=no,height=" + screenheight + ",width=" + screenWidth) ;
window.close();
</script>

ASKER CERTIFIED SOLUTION
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial