RadNotification > NotificationMenu >RadMenuItem OnClick

3 posts, 0 answers
  1. parobe01
    parobe01 avatar
    13 posts
    Member since:
    Dec 2011

    Posted 26 Mar 2012 Link to this post

    I have a RadNotification with RadMenuItems, now on the click of the RadMenuItem, i need to change the stylehsheet path.
     <link rel="stylesheet" type="text/css" title="Classic" href="Classic.css"  />
    <link rel="alternate stylesheet" title="Business" href=Business.css">

    *************************************************************************************
    <telerik:RadNotification ID="RadNotification1" runat="server" VisibleOnPageLoad="true"
                    Width="300" Height="100" Animation="Fade" EnableRoundedCorners="false" EnableShadow="true"
                    Text="Welcome to the new business look for Protiviti's Governance Portal" TitleIcon="client/images/new_small.png"
                    Title="New Business Look" Style="z-index: 35000" Skin="Office2007" Opacity="80"
                    CloseButtonToolTip="Close" KeepOnMouseOver="true" ContentIcon="client/images/business.png"
                    OffsetX="-5" OffsetY="-5" ShowTitleMenu="true">
                    <NotificationMenu Skin="Office2007" >
                        <Items>
                            <telerik:RadMenuItem Text="Classic" ImageUrl="client/images/classic.png" Value="Classic">
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Text="Business" ImageUrl="client/images/business.png" Value="Business">
                            </telerik:RadMenuItem>
                          
                        </Items>
                    </NotificationMenu>
                </telerik:RadNotification>
    *************************************************************************************
    If you could suggest me the method used for RadNotification.

    URGENT!!

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 27 Mar 2012 Link to this post

    Hi,

    As stated in this help article: http://www.telerik.com/help/aspnet-ajax/radnotification-notification-menu.html the Notification menu has the full functionality of the RadContextMenu, so you can use its event handlers freely, for example the OnClientItemClicked:
    <telerik:RadNotification ID="RadNotification1" runat="server" VisibleOnPageLoad="true"
        Width="300" Height="100" Animation="Fade" EnableRoundedCorners="false" EnableShadow="true"
        Text="Welcome to the new business look for Protiviti's Governance Portal" TitleIcon="client/images/new_small.png"
        Title="New Business Look" Style="z-index: 35000" Skin="Office2007" Opacity="80"
        CloseButtonToolTip="Close" KeepOnMouseOver="true" ContentIcon="client/images/business.png"
        OffsetX="-5" OffsetY="-5" ShowTitleMenu="true">
        <NotificationMenu Skin="Office2007" OnClientItemClicked="OnClientItemClicked">
            <Items>
                <telerik:RadMenuItem Text="Classic" ImageUrl="client/images/classic.png" Value="Classic">
                </telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Business" ImageUrl="client/images/business.png" Value="Business">
                </telerik:RadMenuItem>
            </Items>
        </NotificationMenu>
    </telerik:RadNotification>
    with the following JavaScript function:
    function OnClientItemClicked(sender, args)
    {
        var itemValue = args.get_item().get_value();
        switch (itemValue)
        {
            case "Classic": { $get("stylesheetToChange").href = "Classic.css"; break; }
            case "Business": { $get("stylesheetToChange").href = "Business.css"; break; }
            default: { break; }
        }
    }
    and the stylesheet link is modified as follows to allow easy access via JavaScript:
    <link id="stylesheetToChange" rel="stylesheet" type="text/css" title="Classic" href="Classic.css" />



    All the best,
    Marin
    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
  4. parobe01
    parobe01 avatar
    13 posts
    Member since:
    Dec 2011

    Posted 28 Mar 2012 Link to this post

    The code did work :)
    Thanks for the prompt reply...
Back to Top