New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Telerik Notification control

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[RequiredScript(typeof(jQueryPlugins))]
[RequiredScript(typeof(PopupBehavior))]
[RequiredScript(typeof(AnimationScripts))]
[ClientScriptResource("Telerik.Web.UI.RadNotification", "Telerik.Web.UI.Notification.RadNotification.js")]
[TelerikToolboxCategory("Container")]
[ToolboxBitmap(typeof(RadNotification), "Toolbox.Icons.Notification.png")]
[EmbeddedSkin("Notification")]
[EmbeddedSkin("Notification", "Default")]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Classic, typeof(RadNotification))]
[RequiredCss("Telerik.Web.UI.Skins.Common.fonticons.css", RenderMode.Lightweight, typeof(RadNotification))]
public class RadNotification : RadWebControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, IPostBackDataHandler, ISkinnableControl, IControl, INamingContainer

Inheritance: objectControlWebControlRadWebControlRadNotification

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorINamingContainerIParserAccessorIPostBackDataHandlerIScriptControlISkinnableControlIUrlResolutionService...

Inherited Members WebControl.AddAttributesToRender(HtmlTextWriter)WebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.LoadViewState(object)WebControl.TrackViewState()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.RenderContents(HtmlTextWriter)WebControl.SaveViewState()WebControl.AccessKeyWebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnableThemingWebControl.FontWebControl.ForeColorWebControl.HasAttributesWebControl.IsEnabledWebControl.SupportsDisabledAttributeWebControl.SkinIDWebControl.TabIndexWebControl.TagKeyWebControl.TagNameWebControl.ToolTipControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind()Control.DataBind(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.OnInit(EventArgs)Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.OnLoad(EventArgs)Control.OnPreRender(EventArgs)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderChildren(HtmlTextWriter)Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.OnBubbleEvent(object, EventArgs)Control.AddedControl(Control, int)Control.CreateControlCollection()Control.CreateChildControls()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IDControl.IsChildControlStateClearedControl.EnableViewStateControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.RenderingCompatibilityControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ControlsControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

C#
public RadNotification()

Properties

Get/Set the animation effect of the notification

C#
[ClientControlProperty]
public NotificationAnimation Animation { get; set; }
Property Value:

Takes a member of the NotificationAnimation enumeration. None by default.

Sets/gets the duration of the animation in milliseconds. 500 by default.

C#
[ClientControlProperty]
public int AnimationDuration { get; set; }

Specifies the URL of the HTTPHandler that serves the notification sound

C#
public string AudioHandlerUrl { get; set; }

The HTTPHandler should either be registered in the application configuration file, or a file with the specified name should exist at the location, which AudioHandlerUrl points to.

If a file is to serve the files, it should inherit the class Telerik.Web.UI.WebResource

Get/Set the delay after which the notification will hide if not explicitly closed.

C#
[ClientControlProperty]
public int AutoCloseDelay { get; set; }
Property Value:

The value is in milliseconds and defaults to 3000.

Setting the KeepOnMouseOver property to true causes this timer to pause when the mouse is over the control.

Gets or sets the content of the close button tooltip

C#
[Browsable(true)]
[Bindable(true)]
public string CloseButtonToolTip { get; set; }
Property Value:

The default value is Close

Gets the control, where the ContentTemplate will be instantiated in. Controls can be added programmatically here.

C#
[Browsable(false)]
public SingleTemplateContainer ContentContainer { get; }

You can use this property to programmatically add controls to the content area. If you add controls to the ContentContainer the Text and ContentIcon properties will be ignored.

Gets or sets the content icon (built-in or URL for a custom one).

C#
[Browsable(true)]
[Bindable(true)]
public string ContentIcon { get; set; }
Property Value:

The default value is info.

The size of this icon is 32x32 pixels. The list of built-in icons is as follows:

  • info
  • delete
  • deny
  • edit
  • ok
  • warning
  • none

The built-in icons are not available when a custom skin is used for the control, because they are parts of the built-in skins. Also, if the ContentTemplate is used this icon will not be shown.

Get/Set overflow of the notification's content area

C#
[ClientControlProperty]
public NotificationScrolling ContentScrolling { get; set; }
Property Value:

Takes a member of the NotificationScrolling enumeration.

Gets or sets the System.Web.UI.ITemplate that contains the controls which will be placed in the control content area.

C#
[TemplateContainer(typeof(SingleTemplateContainer))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[TemplateInstance(TemplateInstance.Single)]
[Browsable(false)]
[Bindable(false)]
public ITemplate ContentTemplate { get; set; }

You cannot set this property twice, or when you added controls to the ContentContainer. If you set ContentTemplate, Text and ContentIcon properties will be ignored.

When set to true enables support for WAI-ARIA

C#
[ClientControlProperty]
[ClientPropertyName("enableAriaSupport")]
public bool EnableAriaSupport { get; set; }

Gets or sets a value indicating whether the notification is enabled

C#
[Browsable(true)]
[Bindable(true)]
public override bool Enabled { get; set; }
Property Value:

The default value is true.

Overrides: RadWebControl.Enabled

Gets or sets a value indicating whether the notification should have rounded corners

C#
[Browsable(true)]
[Bindable(true)]
public bool EnableRoundedCorners { get; set; }
Property Value:

The default value is false.

The effect is achieved via CSS3 and is not available for older browsers (e.g. Internet Explorer 8, FireFox3).

Gets or sets a value indicating whether the notification should have shadow

C#
[Browsable(true)]
[Bindable(true)]
public bool EnableShadow { get; set; }
Property Value:

The default value is false.

The effect is achieved via CSS3 and is not available for older browsers (e.g. Internet Explorer 8, FireFox3).

Get/Set the Height of the notification in pixels

C#
[ClientControlProperty]
[TypeConverter(typeof(UnitConverter))]
public override Unit Height { get; set; }

Overrides: RadWebControl.Height

Gets or sets a value indicating whether the notification should stay on the screen when hovered (autoclose is delayed until the mouse goes outside the popup).

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool KeepOnMouseOver { get; set; }
Property Value:

The default value is false.

Gets or sets when the content should be loaded.

C#
[ClientControlProperty]
public NotificationLoad LoadContentOn { get; set; }
Property Value:

Takes a member of the NotificationLoad enum.

Works together with UpdateInterval and ShowInterval properties to control how and when new content will be loaded.

Gets the context title menu.

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public RadNotificationContextMenu NotificationMenu { get; }

Get/Set the notification's horizontal offset. Works in cooperation with the Position property.

C#
[ClientControlProperty]
public int OffsetX { get; set; }

Get/Set the notification's vertical offset. Works in cooperation with the Position property.

C#
[ClientControlProperty]
public int OffsetY { get; set; }

Gets or sets a value indicating the name of the client-side event handler that is called when the RadNotification is hidden.

C#
[ClientControlEvent]
[ClientPropertyName("hidden")]
public string OnClientHidden { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientHidden client-side event handler is called after the notification is hidden on the client. Two parameters are passed to the handler:

  • sender, the notification client object;
  • eventArgs
Example:
C#
The following example demonstrates how to use the
<strong>OnClientHidden</strong> property.

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function onClientHiddenHandler(sender, eventArgs)<br />
         {<br />
              var notification = sender;<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;Telerik:RadNotification ID="RadNotification1"<br />
         runat= "server"<br />
        <strong>OnClientHidden="onClientHiddenHandler"</strong>&gt;<br />
        ....<br />
        &lt;/Telerik:RadNotification&gt;
    </div>
</p>

Gets or sets a value indicating the name of the client-side event handler that is called when the RadNotification is to be hidden.

C#
[ClientControlEvent]
[ClientPropertyName("hiding")]
public virtual string OnClientHiding { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientHiding client-side event handler is called before the notification is hidden on the client. Two parameters are passed to the handler:

  • sender, the notification client object;
  • eventArgs

The OnClientHiding event can be cancelled. To do so, set the cancel property to false from the event handler (e.g. eventArgs.set_cancel(true);).

Example:
C#
The following example demonstrates how to use the
<strong>OnClientHiding</strong> property.

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function onClientShowingHandler(sender, eventArgs)<br />
         {<br />
             var shouldHide = confirm("Do you want to hide the notification?")
              eventArgs.set_cancel(!shouldHide);<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;Telerik:RadNotification ID="RadNotification1"<br />
         runat= "server"<br />
        <strong>OnClientHiding="onClientHidingHandler"</strong>&gt;<br />
        ....<br />
        &lt;/Telerik:RadNotification&gt;
    </div>
</p>

Gets or sets a value indicating the name of the client-side event handler that is called before the RadNotification shows.

C#
[ClientControlEvent]
[ClientPropertyName("showing")]
public virtual string OnClientShowing { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientShowing client-side event handler is called before the RadNotification is shown. Two parameters are passed to the handler:

  • sender, the RadNotification object.
  • args.

This event can be cancelled.

Example:
C#
The following example demonstrates how to use the
<strong>OnClientShowing</strong> property.

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function OnClientShowing(sender, args)<br />
         {<br />
         var notification = sender;<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;telerik:RadNotification ID="RadNotification1"<br />
         runat= "server"<br />
        <strong>OnClientShowing="OnClientShowing"</strong>&gt;<br />
        ....<br />
        &lt;/telerik:RadNotification&gt;
    </div>
</p>

Gets or sets a value indicating the name of the client-side event handler that is called just after the RadNotification is shown.

C#
[ClientControlEvent]
[ClientPropertyName("shown")]
public virtual string OnClientShown { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientShown client-side event handler is called after the notification is shown Two parameters are passed to the handler:

  • sender, the RadNotification object.
  • args.

This event cannot be cancelled.

Example:
C#
The following example demonstrates how to use the
<strong>OnClientShown</strong> property.

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function OnClientShown(sender, args)<br />
         {<br />
         var notification = sender;<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;telerik:RadNotification ID="RadNotification1"<br />
         runat= "server"<br />
        <strong>OnClientShown="OnClientShown"</strong>&gt;<br />
        ....<br />
        &lt;/telerik:RadNotification&gt;
    </div>
</p>

Gets or sets a value indicating the name of the client-side event handler that is called when the content of RadNotification is updated.

C#
[ClientControlEvent]
[ClientPropertyName("updated")]
public string OnClientUpdated { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientUpdated client-side event handler is called after the content of the notification is updated. Two parameters are passed to the handler:

  • sender, the notification client object;
  • eventArgs
Example:
C#
The following example demonstrates how to use the
<strong>OnClientUpdated</strong> property.

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function onClientUpdatedHandler(sender, eventArgs)<br />
         {<br />
              var notification = sender;<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;Telerik:RadNotification ID="RadNotification1"<br />
         runat= "server"<br />
        <strong>OnClientUpdated="onClientUpdatedHandler"</strong>&gt;<br />
        ....<br />
        &lt;/Telerik:RadNotification&gt;
    </div>
</p>

Gets or sets a value indicating the name of the client-side event handler that is called when the call to the WebService or the callback is interrupted by an error.

C#
[ClientPropertyName("updateError")]
[ClientControlEvent]
public virtual string OnClientUpdateError { get; set; }

The server error is received as a browser alert() box. It can be avoided by calling the set_cancelErrorAlert(true) method of the event arguments object (the second parameter the event handler receives).

Gets or sets a value indicating the name of the client-side event handler that is called when the content of RadNotification is to be updated.

C#
[ClientControlEvent]
[ClientPropertyName("updating")]
public virtual string OnClientUpdating { get; set; }
Property Value:

A string specifying the name of the JavaScript function that will handle the event. The default value is empty string.

If specified, the OnClientUpdating client-side event handler is called before the content of the notification is updated. Two parameters are passed to the handler:

  • sender, the notification client object;
  • eventArgs

The OnClientUpdating event can be cancelled. To do so, set the cancel property to false from the event handler (e.g. eventArgs.set_cancel(true);).

Cancelling it will prevent the new content from being populated in the notification, but will not prevent the request for the new data.

Example:
C#
The following example demonstrates how to use the
<strong>OnClientUpdating</strong> property.

<p>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;script type="text/javascript"&gt;<br />
         function onClientUpdatingHandler(sender, eventArgs)<br />
         {<br />
             var shouldUpdate = confirm("Do you want to update the content of the notification?")
              eventArgs.set_cancel(!shouldUpdate);<br />
         }<br />
        &lt;/script&gt;
    </div>
    <div class="LanguageSpecific" name="Code_VB">
        &lt;Telerik:RadNotification ID="RadNotification1"<br />
         runat= "server"<br />
        <strong>OnClientUpdating="onClientUpdatingHandler"</strong>&gt;<br />
        ....<br />
        &lt;/Telerik:RadNotification&gt;
    </div>
</p>

Gets or sets a value indicating what should be the opacity of the notification. The value must be between 0 (transparent) and 100 (opaque).

C#
[ClientControlProperty]
public int Opacity { get; set; }
Property Value:

The default value is 100.

Gets or sets a value indicating whether the notification will create an overlay element.

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool Overlay { get; set; }
Property Value:

The default value is false.

The overlay is used to allow the popup to be displayed above heavy-weight objects like PDFs, Flash and Silverlight.

Gets or sets a value indicating whether the notification is pinned (when true it does not scroll with the page).

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool Pinned { get; set; }
Property Value:

The default value is true.

Get/Set the top and left position of the notification relative to the browser

C#
[ClientControlProperty]
public NotificationPosition Position { get; set; }
Property Value:

Takes a member of the NotificationPosition enumeration. BottomRight is the default one.

Gets or sets whether the close [X] button should be visible

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool ShowCloseButton { get; set; }
Property Value:

The default value is true.

Gets or sets when the interval after which the notification will automatically show (in milliseconds).

C#
[ClientControlProperty]
public int ShowInterval { get; set; }
Property Value:

The value is in milliseconds. Defaults to zero (disabled).

Use together with UpdateInterval and LoadContentOn properties to control how and when new content will be loaded.

The counter is reset when the notification shows, not when it hides. In order to make sure there is a certain interval between the hiding and subsequent showing the value of the AutoCloseDelay must also be taken into account (considering KeepOnMouseOver is set to false to ensure that user activity will not interfere with this logic).

Gets or sets the sound to be played on show (built-in or URL for a custom one).

C#
[Browsable(true)]
[Bindable(true)]
public string ShowSound { get; set; }
Property Value:

The default value is none.

  • info
  • warning
  • ok

Gets or sets whether the icon for the title menu should be visible

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool ShowTitleMenu { get; set; }
Property Value:

The default value is true.

Get/Set the Text that will appear in the notification (if there is no ContentTemplate used).

C#
[ClientControlProperty]
public string Text { get; set; }

The control can display a proper HTML string as well. This is an easy way to add simple styling via a simple property.

Get/Set the Text that will appear in the titlebar of the notification.

C#
[ClientControlProperty]
public string Title { get; set; }

Gets or sets the title icon (built-in or URL for a custom one).

C#
[Browsable(true)]
[Bindable(true)]
public string TitleIcon { get; set; }
Property Value:

The default value is info which is one of the built-in icons. It can also take an URL to a custom icon.

The size of this icon is 16x16 pixels. The list of built-in icons is as follows:

  • info
  • delete
  • deny
  • edit
  • ok
  • warning
  • none

The built-in icons are not available when a custom skin is used for the control, because they are parts of the built-in skins.

Gets or sets the content of the the tooltip for the title menu button

C#
[Browsable(true)]
[Bindable(true)]
public string TitleMenuToolTip { get; set; }
Property Value:

The default value is Menu

Gets or sets when the interval (in milliseconds) after which the notification will automatically update the content.

C#
[ClientControlProperty]
public int UpdateInterval { get; set; }
Property Value:

The value is in milliseconds and defaults to zero (disabled).

Use together with ShowInterval and LoadContentOn properties to control how and when new content will be loaded.

Get/Set the an optional Value to pass.

C#
[ClientControlProperty]
public string Value { get; set; }

Can be used to pass arbitrary information especially in Load-on-demand scenarios. For example to the webservice, or from the CallbackUpdate method.

Gets or sets a value indicating whether the notification will open automatically when its parent [aspx] page is loaded on the client.

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool VisibleOnPageLoad { get; set; }
Property Value:

The default value is false.

Gets or sets a value indicating whether the notification has a visible titlebar.

C#
[ClientControlProperty]
[Browsable(true)]
[Bindable(true)]
public bool VisibleTitlebar { get; set; }
Property Value:

The default value is true.

Gets or sets the request method for WCF Service used to populate content GET, POST, PUT, DELETE.

C#
public XmlHttpPanelWcfRequestMethod WcfRequestMethod { get; set; }

Gets or sets a string value that indicates the WCF Service method used to populate content.

C#
public string WcfServiceMethod { get; set; }

Gets or sets a string value that indicates the virtual path of the WCF Service used to populate content.

C#
public string WcfServicePath { get; set; }

Gets or sets the web method name in the web service used to populate content.

C#
public string WebMethodName { get; set; }

Gets or sets the path to the web service used to populate content.

C#
public string WebMethodPath { get; set; }

Get/Set the Width of the notification in pixels

C#
[ClientControlProperty]
[TypeConverter(typeof(UnitConverter))]
public override Unit Width { get; set; }

Overrides: RadWebControl.Width

Methods

The prototype of the event handler for the callback update load-on-demand mechanism. Prepares the event arguments.

C#
protected virtual void OnCallbackUpdate(RadNotificationEventArgs e)
Parameters:eRadNotificationEventArgs

The argument received by the handler is of type RadNotificationEventArgs.

Shows the notification when the page is loaded on the client.

C#
public void Show()

It does not require that the control is updated after a partial postback in order to work.

Shows the notification when the page is loaded on the client with the new text that is provided as an argument.

C#
public void Show(string text)
Parameters:textstring

The new text that will be shown in the notification. Can be an HTML string.

It does not require that the control is updated after a partial postback in order to work. This text will not be persisted in the ViewState or after postbacks

Events

This event is raised when content must be loaded on demand via a callback.

C#
public virtual event RadNotificationEventHandler CallbackUpdate