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

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

1 Answer 158 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Donald
Top achievements
Rank 1
Donald asked on 04 Feb 2013, 08:43 PM
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

 

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 06 Feb 2013, 02:39 PM
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.
Tags
Notification
Asked by
Donald
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or