Notification - WAI-ARIA Support

 
 
 
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

The RadNotification control has WAI-ARIA support which can be easily enabled by setting EnableAriaSupport="true"

The textboxes have a RequiredFieldValidator set to each of them. If you do not put text in one or more of them, a RadNotification with the validation errors will show when you try to submit the page.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Notification.WAIARIASupport.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <script type="text/javascript">
        function showNotification() {
            var notification = $find("<%=RadNotification1.ClientID %>");
            setTimeout(function () {
                notification.show();
            }, 0);
        }

        function CheckIfShow(sender, args) {
            var summaryElem = document.getElementById("<%= ValidationSummary1.ClientID%>");
            //check if summary is visible - if not, there are not errors, do not notify and continue with postback
            var noErrors = summaryElem.style.display == "none";
            args.set_cancel(noErrors);
        }
    </script>
    <div class="demo-container" id="demo-container">
        <div class="contentDiv">
            <div class="inputWrap">
                <label id="firstNameLabel" for="firstName">
                    First Name
                </label>
                <asp:TextBox ID="firstName" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="firstName"
                                            Text="*" ErrorMessage="Please, fill in your first name!">
                </asp:RequiredFieldValidator>
            </div>
            <div class="inputWrap">
                <label for="lastName">
                    Last Name
                </label>
                <asp:TextBox ID="lastName" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvLastName" runat="server" ControlToValidate="lastName"
                                            Text="*" ErrorMessage="Please, fill in your last name!">
                </asp:RequiredFieldValidator>
            </div>
            <div class="inputWrap">
                <label for="address">
                    Address
                </label>
                <asp:TextBox ID="address" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="rfvAddress" runat="server" ControlToValidate="address"
                                            Text="*" ErrorMessage="Please, fill in your address!">
                </asp:RequiredFieldValidator>
            </div>
            <div class="inputWrap submitRow">
                <asp:Button ID="btnSubmit" runat="server" OnClientClick="showNotification();" Text="Submit">
                </asp:Button>
            </div>
        </div>
    </div>
    <telerik:RadNotification RenderMode="Lightweight" ID="RadNotification1" runat="server" Width="300" Animation="Fade"
                             OnClientShowing="CheckIfShow" EnableRoundedCorners="true" EnableShadow="true"
                             LoadContentOn="PageLoad" Title="Validation errors" OffsetX="-20" OffsetY="-20"
                             TitleIcon="warning" EnableAriaSupport="true" ShowSound="warning" AutoCloseDelay="7000">
        <ContentTemplate>
            <asp:ValidationSummary ID="ValidationSummary1" runat="server"></asp:ValidationSummary>
        </ContentTemplate>
    </telerik:RadNotification>
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecoratedControls="All" DecorationZoneID="demo-container" />
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?