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

Session Timeout - Continue button not working 2nd time

4 Answers 399 Views
Notification
This is a migrated thread and some comments may be shown as answers.
John Snyder
Top achievements
Rank 1
John Snyder asked on 22 Aug 2011, 03:11 PM
For testing purposes I have my session timeout set to 3 minutes.  2 minutes before session timeout the popup will appear.  If I click "Continue" it stays on the page and hides the dialog.  A minute later it will popup again as expected, but this time clicking the "Continue" button doesn't work at all.

I am not getting any javascript errors.  If I put an alert in the ContinueSession method I get there after the first click, but not after the second click.

Javascript Code:
<script language="javascript">
    //a flag to ease the logic which determines whether to redirect the user
    //will not redirect if the RadButton is clicked
    var toRedirect = true;
 
    function OnClientHiding(sender, args) {
        if (toRedirect) {
            window.location.href = sender.get_value();
        }
    }
    function ContinueSession() {
        var notification = $find("<%= rnSessionTimeout.ClientID %>");
        toRedirect = false;
        notification.update();
        notification.hide();
    }
    function OnClientShowing() {
        //raise the flaga again so that a redirect will occur if the notification autocloses
        toRedirect = true;
    }
</script>

HTML Code:
<telerik:RadNotification ID="rnSessionTimeout" runat="server" Position="Center" Width="300"
    Height="125" LoadContentOn="PageLoad" AutoCloseDelay="105000"
    Title="Session Expiration" TitleIcon="Warning" OnClientShowing="OnClientShowing"
    ContentIcon="Warning" Skin="Default" EnableRoundedCorners="true" OnClientHiding="OnClientHiding">
    <ContentTemplate>
        <p align="left">
            Your session is about to expire. Do you wish to continue using this site?<br />
            <telerik:RadButton Skin="Default" ID="continueSession" runat="server" Text="Continue Your Session" Style="margin-top: 10px;" OnClientClicked="ContinueSession" Autopostback="false" />
        </p>
    </ContentTemplate>
</telerik:RadNotification>

Code Behind:
Protected Sub rnSessionTimeout_CallbackUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadNotificationEventArgs) Handles rnSessionTimeout.CallbackUpdate
End Sub



4 Answers, 1 is accepted

Sort by
0
John Snyder
Top achievements
Rank 1
answered on 22 Aug 2011, 04:42 PM
FYI - I think I may have found a solution to this, though it is not a solution I wanted.

I changed the Telerik Button to a normal ASP.Net button and it solved my issue.  Not sure why this was an issue.

New HTML Code:
<telerik:RadNotification ID="rnSessionTimeout" runat="server" Position="Center" Width="300"
    Height="125" LoadContentOn="PageLoad" AutoCloseDelay="105000"
    Title="Session Expiration" TitleIcon="Warning" OnClientShowing="OnClientShowing"
    ContentIcon="Warning" Skin="Default" EnableRoundedCorners="true" OnClientHiding="OnClientHiding">
    <ContentTemplate>
        <p align="left">
            Your session is about to expire. Do you wish to continue using this site?<br />
            <asp:Button ID="btnContinue" runat="server" Text="Continue Session" OnClientClick="ContinueSession(); return false;" />
        </p>
    </ContentTemplate>
</telerik:RadNotification>

Not sure if there is a bug in the Telerik:RadButton or if it is something else, but the normal button seems to have fixed my issue (though it doesn't look as nice as the Telerik RadButton.
0
Marin Bratanov
Telerik team
answered on 23 Aug 2011, 03:45 PM
Hello Dustin,

There was a known issue when the RadNotification has AJAX-enabled controls in its ContentTemplate and a callback occurs. The scripts were not executed properly after that. This has been fixed internally and I would advise that you try the latest internal build and see if it solves your issue. If you do not wish to upgrade for the time being (at least before the Q2 2011 SP1 release) you can use the following workaround:
function pageLoad() {
    var xmlPanel = $find("<%= RadNotificationSessionTimeout.ClientID %>")._xmlPanel;
    xmlPanel.set_enableClientScriptEvaluation(true);
}



Regards,
Marin
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Tawnya
Top achievements
Rank 1
answered on 29 Dec 2011, 04:48 PM
I tried this and am still having issues. Actually, it's legacy VB.NET code and I'm trying to add the radnotification for session timeout purposes. It doesn't like the xmlPanel piece and I have updated to the latest available update.

I've been working on a solution for this 2 days now. Any help is appreciated. Thanks.
0
Svetlina Anati
Telerik team
answered on 03 Jan 2012, 02:32 PM
Hi Tawnya,

The suggested solution should work if you experience the same issue - everything works with a standard control inside the notification but switching to a RadControl (RadButton in this case) breaks the functionality. If this is not the case, this will not fix it but the problem is in the implementation logic.

What I can suggest is the following:

1) Test with the latest version of Telerik.Web.UI
2) Make sure you do not get any javascript errors
3) Make sure you step into the corresponding functions and all the handlers are correctly attached

If the above does not help, please prepare a very simple, fully runnable reproduction demo, open a new support ticket and send it to us along with detailed explanations and we will fix it so that you will be then able to apply the same logic in your original application.


 Kind regards,
Svetlina Anati
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Notification
Asked by
John Snyder
Top achievements
Rank 1
Answers by
John Snyder
Top achievements
Rank 1
Marin Bratanov
Telerik team
Tawnya
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or