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

get_text() problem

3 Answers 52 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Sasha
Top achievements
Rank 1
Sasha asked on 11 Nov 2011, 06:37 AM
Ok, so I started using this control, implemented some basic web service method to handle the updates of the notification control. This all works fine. The text sent from the WebService is set and the notification is displayed. However what I would like to do is display the notification only if the text sent from the web service is not string.Empty. So logic told me to use OnClientShowing or OnClientUpdated methods to check for the text of the notification and if it's not empty allow the control to show, if it's empty use the set_cancel(true) to cancel the showing. However, when i use sender.get_text() the value is always empty. What am I doing wrong here and how can I achieve what I'm trying to achieve here?

Regards,
Sasha.

3 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 11 Nov 2011, 11:11 AM
Hi Sasha,

 
I suggest to handle the OnClientUpdating event and use the args.get_content method as follows:

function OnClientUpdating(sender, args) {
         if(args.get_content() != "")
         {
                //custom logic goes here
          }
       }


You can see this method in some of our online demos, e.g in the following one:

http://demos.telerik.com/aspnet-ajax-beta/notification/examples/clientsideevents/defaultcs.aspx

Please, test my suggestion and let me know how it goes.


All the best,
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
0
Sasha
Top achievements
Rank 1
answered on 11 Nov 2011, 05:19 PM
Hi Svetlina,

Though that did in fact solve my issue I'm left wondering what is the purpose of the Help Files if the things written there aren't correct? Don't get me wrong I'm not flaming anyone here, I'm just wondering how was I supposed to know to use get_content when it's not even mentioned in client-side API and how was I supposed to know to use the OnClientUpdating when the documentation says the following:

The OnClientUpdating event occurs just BEFORE the notification content is updated. This event is cancellable. It will not be fired when the content is static. It is only fired when new content is received via a WebService or via a callback.

Notice the CAPS-ed text. It means this event gets the content before the control's content was updated. According to your documentation the proper even would be either OnClientUpdated or OnClientShowing which is what I was trying to use. As for your previous reply thanks for your help that did in fact work.

Regards and hope you can answer these questions of mine,
Sasha.
0
Marin Bratanov
Telerik team
answered on 14 Nov 2011, 10:51 AM
Hello Sasha,

Please accept our apologies for the omission in the documentation. This article has been fixed and will be live with our next upload (right after the Q3 release is live).

As a token of gratitude for pointing us to this misleading information I have updated your Telerik points.


All the best,
Marin
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
Sasha
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Sasha
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or