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

RadNotification > NotificationMenu >RadMenuItem OnClick

2 Answers 108 Views
Notification
This is a migrated thread and some comments may be shown as answers.
parobe01
Top achievements
Rank 1
parobe01 asked on 26 Mar 2012, 01:12 PM

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 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 27 Mar 2012, 12:30 PM
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.
0
parobe01
Top achievements
Rank 1
answered on 28 Mar 2012, 05:25 AM
The code did work :)
Thanks for the prompt reply...
Tags
Notification
Asked by
parobe01
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
parobe01
Top achievements
Rank 1
Share this question
or