Following the directions from this demo (http://demos.telerik.com/aspnet-ajax/notification/examples/sessiontimeout/defaultcs.aspx), I've managed to get my radnotification to popup and when the button is clicked, extend the session. I did have to change the radbutton to a standard button because it would not fire when clicked.
However, I am unable to get the time label to update on the notification nor can it redirect to the page set in the value property. I will post the code to show what I have so far.
in the javascript, I have this:
And I have a sub for the OnCallBackUpdate that is empty:
Basically, I have everything like the example. I set the showInterval and AutoCloseDelay set low for testing purposes.
Any ideas? I've researched for days and haven't figured out why it isn't working.
I did add an alert temporarily to the code that updates the label and it never hits it except when I set it to the onclientclicked event. But, it only hits it, it doesn't execute it.
However, I am unable to get the time label to update on the notification nor can it redirect to the page set in the value property. I will post the code to show what I have so far.
<
telerik:RadNotification
ID
=
"rnSessionTimeOut"
runat
=
"server"
Skin
=
"Black"
AutoCloseDelay
=
"60000"
Title
=
"Continue Your Session"
TitleIcon
=
""
EnableRoundedCorners
=
"true"
ShowInterval
=
"61000"
Value
=
"Search.aspx"
OnCallbackUpdate
=
"OnCallbackUpdate"
Position
=
"Center"
>
<
ContentTemplate
>
<
div
class
=
"infoIcon"
>
<
img
id
=
"Img1"
src
=
"~/images/infoIcon.png"
runat
=
"server"
alt
=
"info icon"
/></
div
>
<
div
class
=
"notificationContent"
>
Time remaining: <
span
id
=
"timeLbl"
>60</
span
>
<
asp:Button
ID
=
"btnContinue"
runat
=
"server"
Text
=
"Continue Session"
OnClientClick
=
"ContinueSession(); return false;"
/>
</
div
>
</
ContentTemplate
>
</
telerik:RadNotification
>
in the javascript, I have this:
<
script
type
=
"text/javascript"
>
//update the text in the label in RadNotification
//this could also be done automatically by using UpdateInterval. However, this will cause callbacks [which is the second best solution than javascript] on every second that is being count
function UpdateTimeLabel(toReset) {
var sessionExpired = (seconds == 0);
if (seconds == 0) {
stopTimer("timeLeftCounter");
//redirect to session expired page - simply take the url which RadNotification sent from the server to the client as value
window.location.href = $find("RadNotification1").get_value();
}
else {
var timeLbl = $get("timeLbl");
timeLbl.innerHTML = seconds--;
}
}
function ContinueSession() {
var notification = $find("rnSessionTimeOut");
//we need to contact the server to restart the Session - the fastest way is via callback
//calling update() automatically performs the callback, no need for any additional code or control
notification.update();
notification.hide();
//resets the showInterval for the scenario where the Notification is not disposed (e.g. an AJAX request is made)
//You need to inject a call to the ContinueSession() function from the code behind in such a request
var showIntervalStorage = notification.get_showInterval(); //store the original value
notification.set_showInterval(0); //change the timer to avoid untimely showing, 0 disables automatic showing
notification.set_showInterval(showIntervalStorage); //sets back the original interval which will start counting from its full value again
stopTimer("timeLeftCounter");
seconds = 60;
updateMainLabel(true);
}
</
script
>
And I have a sub for the OnCallBackUpdate that is empty:
Sub OnCallbackUpdate()
End Sub
Any ideas? I've researched for days and haven't figured out why it isn't working.
I did add an alert temporarily to the code that updates the label and it never hits it except when I set it to the onclientclicked event. But, it only hits it, it doesn't execute it.