This is a migrated thread and some comments may be shown as answers.

Close window from login control

4 Answers 286 Views
Window
This is a migrated thread and some comments may be shown as answers.
Clayton
Top achievements
Rank 2
Clayton asked on 15 Jan 2008, 01:18 AM
I am trying to create a window for use with the asp:login control, but having trouble getting the window to close when logged in automatically.

1) I created a User Control that has a LoginView, showing a button of "Login" or  "Logout" accordingly to current status.  This control will always be at the top right of every page (master page).  When clicked, it opens a window that points to the loginpage.aspx.

2)  Loginpage.aspx has a LoginView that shows the Login control and the LoginStatus appropriately.  Within the Login control's template I added a button [Cancel] that closes the window. 


What I would like is when user clicks the [Login] button, that it automatically closes the window and refreshes the parent.  Problem I am finding is trapping the code to perform this. 
  • Using the OnLoggedIn event and codebehind, I can do a Request.Redirect, but I don't know the parent nor does the redirect work properly (redirects within window).
  • Java script, I can get the parent window and redirect, but can't get the code to call the script.
  • Tried combining prior to by injecting script out to label control on the OnLoggedIn event, but that didn't seem to work.

I am using VS 2008 and find attempting to debug is very difficult given the CMS system this is built upon and the various relative paths in it (VS 2008 wants to create port/instances for debugging, changing the effective URL).


Any thoughts on how to accomplish this?

4 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 15 Jan 2008, 04:24 PM
Hi Clayton,

The easiest way to get the parent and navigate it to a new Url would be to use Javascript (top.location.href="your new Url"). You can check the following Code Library to see this approach in action:
Using r.a.d.window for a login form.

If you still experience problems with RadWindow, our suggestion is to implement the desired logic by using a standard browser's popup (window.open()). Once your code is working as expected, it will work with RadWindow as well - note that when you navigate away the parent page, the RadWindow that was called from that page and which contains your login form will be closed as well.



All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Clayton
Top achievements
Rank 2
answered on 15 Jan 2008, 05:38 PM
Guess I wasn't completely clear in my initial explanation.  I have the javascript that can refresh the parent.  What I am having problems with is connecting the asp:login control to run that client side script.  I tried injecting the javascript to close the window from the server side on the loggedin event, but it didn't work.

Clayton
0
Clayton
Top achievements
Rank 2
answered on 16 Jan 2008, 01:47 AM
I traced the issue with the injection of code via a label not working to be due to the page loading twice.  Setting a flag (bool closeWindow) on the login event, during the prerender event, it sees the flag and injects script.  But then page is read again (logout event doesn't fire twice) and this time that flag isn't set, so no injection occurs.

What is causing the page to double load?

Clayton
0
Georgi Tunev
Telerik team
answered on 18 Jan 2008, 01:37 PM
Hello Clayton,

Have you set by any chance the ReloadOnShow property to true? If this is so, this can be the reason for the double loading of the page. In such case, please set the property to false and see how your application will behave.

If you still experience problems, please open a support ticket and send us a reproduction project which we can examine and we will do our best to help.






Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Clayton
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Clayton
Top achievements
Rank 2
Share this question
or