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

Refreshing On Interval Clears Content

1 Answer 60 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Mirek
Top achievements
Rank 1
Mirek asked on 22 Jul 2016, 07:17 PM

I have a simple update on interval application (pretty much same as this demo: http://demos.telerik.com/aspnet-ajax/notification/examples/updateinterval/defaultcs.aspx ).

 

The problem is if you set the updateinterval for a length of time less than the autoclosedelay it blanks out the popup (clears the content of the literal).  In other words if I check for new messages while a message is already visible, even if there are no new messages, the page posts back and my message is empty.

Is there some easy way to get around this or do I have to do something like store the value in a session/page variable etc.?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 25 Jul 2016, 11:45 AM

Hello Mirek,

The demo shows such a way—intercepting the OnClientUpdated event, checking for the information the server returns through the Value property and making a decision based on that. For example, you can call the hide() method of the notification if there is no new data.

Otherwise, as long as you return some text, the notification will not be empty. Here is a small example that illustrates this:

<telerik:RadNotification ID="RadNotification1" runat="server" OnCallbackUpdate="RadNotification1_CallbackUpdate" AutoCloseDelay="0" VisibleOnPageLoad="true" LoadContentOn="TimeInterval" UpdateInterval="2000" Width="200" Height="100"></telerik:RadNotification>
protected void RadNotification1_CallbackUpdate(object sender, RadNotificationEventArgs e)
{
    (sender as RadNotification).Text = DateTime.Now.ToString();
}


Regards,

Marin Bratanov
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Notification
Asked by
Mirek
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or