|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ASP.Net/C# - How to resize the web browser and hide the menu bar when opening a web page
Hi,
I’m using ASP .Net 2.0 and C# language to develop a web page. I have an issue of opening a new web page through my login page because of the following functionality. I would really appreciate if someone could help me with it. I have added some validations to be done in my “btnLogIn_Click” event in my Login.aspx page, and only if the validations are successful I need to redirect to the other page. These validations are server-side validations. But, I also need to resize the browser of the new page so that it will fit the contents of the web page. My two web pages are named as Login.aspx and NewPage.aspx. Please note that I do NOT want my NewPage.aspx to be a pop up window. It should be a normal web page that I call through my Login.aspx page. I have tried two methods to fulfil this requirement. Method 1 I added the following code to my NewPage.aspx so that it will resize the browser when it is loaded according to the size specified. This code works fine, but I need to hide the toolbars and the menu bars of the browser. Does anyone know how to hide the toolbars and the menu bars on the browser? [code] <script language="JavaScript" type="text/javascript" > window.resizeTo(500,750); window.moveTo(200,100); </script> Method 2 I have written the following javascript to open a window without toolbars etc and this will redirect to the next page as well. [code] <script language="JavaScript" type="text/javascript" > function OpenNewWP() { newWin = window.open('OnlinePayments.aspx','form1','toolbar =no,status=no,menubar=no,location=center,scrollbar s=no,resizable=no,height=500,width=350'); newWin.opener = top; } </script> The issue that I’m facing is that in my page load event of the Login.aspx page I have the following code: [code] btnLogIn.Attributes.Add("onclick", "disableLoginButton();" + this.GetPostBackEventReference(btnLogIn)); The “disableLoginButton()” is a javascript function that I use to disable the login button as soon as it is clicked. The “this.GetPostBackEventReference(btnLogIn)” will next fire the “btnLogIn_Click” event. I tried writing the code as follows to see whether the javascript gets fired. This code does fire the OpenNewWP() and redirects to the NewPage.aspx as a normal web page (not a popup window. I came to this conclusion because I have blocked popups in my browser) but, irrespective of the conditions in the btnLogIn_Click event handler because it does not fire before redirection. [code] btnLogIn.Attributes.Add("onclick", "disableLoginButton();OpenNewWP()" + this.GetPostBackEventReference(btnLogIn)); Can someone please tell my how to call the “OpenNewWP()” javascript function depending on a condition in “btnLogIn_Click” event handler code? Also, how can I close my Login.aspx page when I load the NewPage.aspx? Thanks! |
|
#2
|
||||
|
||||
|
try working with Modal Window:
http://javascript.about.com/library/blmodal.htm |
|
#3
|
|||
|
|||
|
Hi,
Thanks for your reply. I'm new to the model window concept. But, this is to open a pop up window right? But, I do not want a pop up window. I just want to open a new web page but with a resized height and width. Do you know how I can do this? Thanks! |
|
#4
|
||||
|
||||
|
you mean resize the current window?
|
|
#5
|
|||
|
|||
|
Yes. For example, I need to call Page2.aspx from my Login Page. So when Page2.aspx is loaded it should be resized to the width and height that I set. This is because that page has little contents and looks ugly in a large normal size web page.
Also, needs to remove the title bar, menu bar etc from that page. Thanks! |
|
#6
|
||||
|
||||
|
so call Page2.aspx as Dialog window. this way it's possible to both define desired
width and height, and have no bars like you want. |
|
#7
|
|||
|
|||
|
Dialog window will act like a popup window right? Please correct me if I'm wrong.
I dont like to call a popup window because if the user has blocked the popups it will not show him. |
|
#8
|
||||
|
||||
|
well, you can resize the current window using window.resizeTo() JavaScript
function, but you can't remove the title, menu or toolbars. |
|
#9
|
|||
|
|||
|
Thanks.
I have tried that. But was wondering if there was any other way of implementing this functionality. Which calls a normal window (not a popup) with a given width and height and also without any toolbars etc. |
|
#10
|
||||
|
||||
|
Quote:
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > ASP.Net/C# - How to resize the web browser and hide the menu bar when opening a web page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|