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

Changing RadAlert icons based on success/failure alert.

1 Answer 317 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 2
Sean asked on 19 Aug 2011, 05:59 PM
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? 

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 22 Aug 2011, 03:27 PM
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 >>

Tags
Window
Asked by
Sean
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Share this question
or