Client-side Events Overview
RadNotification provides the following client-side events:
-
OnClientShowing - fires just before RadNotification is shown. It can be canceled.
-
OnClientShown - fires after RadNotification is shown.
-
OnClientUpdating - fires just before RadNotification content is updated. It can be canceled.
-
OnClientUpdated - fires after RadNotification content is updated.
-
OnClientUpdateError - fires if an error was thrown when RadNotification content is updated. An error alert which can be canceled is displayed.
-
OnClientHiding - fires just before RadNotification hides.
-
OnClientHidden - fires after RadNotification hides.
If a Notification Menu is configured, it has its own client events as specified in the Client-Side Events article of RadContextMenu.
To use these events, simply write a JavaScript function that can be called when the event occurs. Then assign the name of the JavaScript function as the value of the the corresponding property.
<telerik:RadNotification RenderMode="Lightweight" runat="server" ID="RadNotification1" VisibleOnPageLoad="true"
Position="BottomRight" Width="250px" Height="100px"
OnClientShowing="OnClientShowing" Text="Sample notification text">
</telerik:RadNotification>
<script type="text/javascript">
function OnClientShowing(sender, eventArgs)
{
alert("OnClientShowing event fired by RadNotification with id: " + sender.get_id());
}
</script>
You can also modify the event handlers dynamically via JavaScript. For more information see the Setting Event Handlers via JavaScript article.