Changing RadAlert icons based on success/failure alert.

2 posts, 1 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 19 Aug 2011 Link to this post

    Hi Telerik,

    I have the following code:

    function SaveDashboard(pane, eventArgs) {
        loadingPanel = $find(radAjaxLoadingPanel1ID);
        loadingPanel.show(baseSplitterID);
        eventArgs.set_cancel(true);
        window.PageMethods.SaveToDatabase(
            function (result) {
                if (result == true) {
                    window.radalert('Dashboard saved successfully.', 275, 100, "Save Successful");
                }
                else {
                    window.radalert('Dashboard NOT saved successfully.', 240, 100, "Save Unsuccessful");
                }
                loadingPanel.hide(baseSplitterID);
            });
    }

    I would like to display icons indicative of success/failure. That is, changing the titlebar LHS icon and the LHS icon in the body of the window. Do I need to use a full radwindow to do this? 
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 22 Aug 2011 Link to this post

    Hi Sean,

    The RadAlert is actually a full RadWindow, so you can use the RadWindow's client-side API to modify it. It would behave like radopen() - i.e. events like OnClientBeforeShow would not be available. We actually have recently made some fixes on the setting of the title icon (available in the internal builds). As for the icon in the body - you can use a rather simple JavaScript function, as it is a matter of traversing the DOM and changing a CSS property:
    radalert('warning'); 
    $telerik.$(".radalert").css("background-image", "url('custom-content-icon.png')");

     What I can also suggest is our new RadNotification control, which provides several built-in icons, the ability to choose your own icon, animations, positioning, as well as server-side Show() method, client-side event handlers and many more features.

    Kind regards,
    Marin
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top