How to Clear Notification (Client & Server) on Hide (Manual Close)

2 posts, 0 answers
  1. Donald
    Donald avatar
    10 posts
    Member since:
    Jan 2009

    Posted 04 Feb 2013 Link to this post

    I have RadNotification working well with a web service providing the content of the Notificaiton using

         notification.update();

         notification.show();

    when I want to show the Notification.

    I want to clear the Notificaiton content each time the user clicks on the Notification Close button.

    I've had a hard time getting it to clear on both the client and the server without side effects.  I have it sort of working now, but the notification flashes on loading the page.

    I'm sure there is a simple, clean way to do this, but I haven't been able to figure it out -- after spending a lot of time and searching both the Telerik website and using Google.

    Thanks,

    Donald

     

     

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 06 Feb 2013 Link to this post

    Hi Donald,

    Could you explain your issue in greater detail? What do you have in mind with clearing the value in the server if you are using a webservice, which is stateless? Also, what does flashing when page is loading mean? If you have set the control to update on PageLoad or you have set its VIsibleOnPageLoad property to true it would show when the page is loaded.

    For clearing the values upon closing from the [x] button - you can use the OnClientHiding event which exposes information whether the user clicked the close button: http://www.telerik.com/help/aspnet-ajax/notification-on-client-hiding.html - the get_manualClose() method of the event arguments object. If this flag is true you can use the control's client-side API to clear its text, e.g. set_text("").

    I believe the following demos can illustrate the logic nicely:
    http://demos.telerik.com/aspnet-ajax/notification/examples/webservice/defaultcs.aspx - on using a webservice in general
    http://demos.telerik.com/aspnet-ajax/notification/examples/updateinterval/defaultcs.aspx - on updaring on a time interval and only showing if there is new content to show

    If after that you still need to clear a certain value I would need more information on the problem and scenario in order to suggest a suitable idea. Generally, with webservices there isn't a state left on the server and if the notification is shown only if and when new content arrives you shouldn't need to clear anything else on the client, too.

    Note that in the second demo the LoadContentOn is set to TimeInterval. The following article shows several common scenarios and explanations on how to combine the main properties of the control: http://www.telerik.com/help/aspnet-ajax/notification-server-side-overview.html.

    Regards,
    Marin Bratanov
    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
Back to Top