get_text() problem

4 posts, 1 answers
  1. Sasha
    Sasha avatar
    8 posts
    Member since:
    Feb 2011

    Posted 11 Nov 2011 Link to this post

    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.
  2. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 11 Nov 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sasha
    Sasha avatar
    8 posts
    Member since:
    Feb 2011

    Posted 11 Nov 2011 Link to this post

    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.
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 14 Nov 2011 Link to this post

    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
Back to Top