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

Notification on Interval from Web Service

2 Answers 40 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 24 Jul 2015, 02:37 PM

Hi

 

im probably being a bit silly but i cant work out how to get this to work properly i want the notification to check on an interval , but get the data from a web service , but if there is no data from the web service i dont want it to pop anything up.

 

this is what i have so far

     <telerik:RadNotification ID="RadNotification1" Animation="Slide" runat="server" OffsetX="-20"<br>        VisibleOnPageLoad="true" OffsetY="-20" Width="250px" Height="80px" LoadContentOn="TimeInterval"<br>        WebMethodName="GetWeatherForcast" WebMethodPath="../Services/EclipseService.asmx"<br>        UpdateInterval="30000" AutoCloseDelay="1500" KeepOnMouseOver="true" RenderMode="Lightweight"<br>        VisibleTitlebar="false" Value="rainyState" EnableRoundedCorners="true" Skin="Office2007" OnClientUpdated="OnClientUpdated"><br>    </telerik:RadNotification>

 

and for the JS function

    function OnClientUpdated(sender, args) {
        var newMsgs = sender.get_value();
        if (newMsgs != 0) {
            sender.show();
        }
    }

 

it mostly seems to work , but i need it not to pop up anything when no data is returned from the web service ?

 ​

2 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 27 Jul 2015, 10:00 AM

done some additional work and found that i should be using the get_content call

 

but i am getting an error Object doesn't support property or method 'get_content'

any help is appreciated.
0
Ianko
Telerik team
answered on 29 Jul 2015, 07:11 AM
Hello Peter,

Yes, you should use the get_content() method to programmatically understand whether the notification is loaded with no content and if so to cancel the continuation of loading via set_cancel(true) method. However, these methods are exposed in the OnClientUpdating event not OnClientUpdated.

You can find attached a simple demo that demonstrates how to implement the required behavior.

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Notification
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or