|
-
September 4th, 2008, 07:00 PM
#1
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?
<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.
<script language="JavaScript" type="text/javascript" >
function OpenNewWP()
{
newWin = window.open('OnlinePayments.aspx','form1','toolbar=no,status=no,menubar=no,location=center,scrollbars=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:
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.
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!
-
September 10th, 2008, 03:33 AM
#2
Re: How to resize the web browser and hide the menu bar when opening a web page
Hi, why don't you try calling the OpenNewWP() javascript function after the execution of the this.GetPostBackEventReference(btnLogIn) and see if it works or not. Sometimes the ordering of the functions in incorrect order results in the problem.
-
September 11th, 2008, 08:09 PM
#3
Re: How to resize the web browser and hide the menu bar when opening a web page
Hi,
Well yeah I tried using the following method:
btnLogIn.Attributes.Add("onclick", "disableLoginButton();" +
this.GetPostBackEventReference(btnLogIn) + "OpenNewWP();");
But, it gives me the runtime error "Expected ';'"
Also, OpenNewWP() should fire depending on a condition inside btnLogin click event handler which is called by this.GetPostBackEventReference(btnLogIn)
I want to know a method to call this function with the others or any other way of implementing the following:
Calling a new web page which is of a fixed width and height with no toolbars and menu bars.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|