M_Dec
September 1st, 2008, 09:18 PM
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 not 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!
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 not 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!