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

How to show a RadAlert on a modal RadWindow before closing the radwindow.

6 Answers 137 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tripati
Top achievements
Rank 1
Tripati asked on 04 Jul 2013, 03:05 PM

Hi,

How to show a RadAlert on a modal RadWindow befor closing the radwindow.

Requirement Step:
1) Open a page (Say EmployeeList.aspx).
2) Open a radwindow as modal window using a button. Radwindow is navigating to other page (Say EditEmployee.aspx).
3) Modal window contails "Save" and "Cancel" button.
4) Once user edits the data and hit Save button - we need to show a radalert saying 'Data Saved Successfully' and the modal window needs to closed automatically.

Problem is: As I am closing the radwindow to refresh the parent page grid, radalert message is not getting displayed. Also I can't use asp.net alert coz normal alert will not allow me to change the alert (yellow) icon to information icon. Kindly help on this

Java script code on EditEmployee.aspx to close the modal window:

function CloseAndRebind(args) {
                radalert('Data Saved successfully', 330, 100, 'Client RadAlert', null);
                GetRadWindow().BrowserWindow.refreshGrid(args);
                GetRadWindow().close();
            }
 
function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
 
                return oWindow;
            }
 
function CloseWindow() {
                GetRadWindow().close();
            }

6 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 05 Jul 2013, 09:34 AM
Hello Tripati,

You need to use the callback function of the RadAlert dialog to close the RadWIndow. This will make the code execute only after the alert has closed:
function CloseAndRebind()
{
    function callbackFn(arg)//the value indicates how the dialog was closed
    {
        GetRadWindow().BrowserWindow.refreshGrid(args);
        GetRadWindow().close();
    }
    radalert('Data Saved successfully', 330, 100, 'Client RadAlert', callbackFn);
}

Details on working with these dialogs are available here:
http://www.telerik.com/help/aspnet-ajax/window-dialogs-alert.html
http://demos.telerik.com/aspnet-ajax/window/examples/confirmserverclicks/defaultcs.aspx

Regards,
Marin Bratanov
Telerik
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 the blog feed now.
0
Tripati
Top achievements
Rank 1
answered on 05 Jul 2013, 10:46 AM
Hi Marin,

Thanks for quick response.

But I am facing a challenge with the 'radalert' syntax.
radalert('Data Saved successfully', 330, 100, 'Client RadAlert', callbackFn);

The above code is giving me null reference error. (Refer attachment)

Is there a different way to access radalert in javascript on a modal RadWindow? I am using Q3, 2011 version.

Kindly help on this

Thanks
Tripati


0
Shinu
Top achievements
Rank 1
answered on 05 Jul 2013, 11:04 AM
Hi Tripati,

Check whether you have the RadWindowManager on your aspx page because all these RadAlert, RadConfirm and RadPrompt dialogs require a RadWindowManager on the page.

Thanks,
Shinu.
0
Tripati
Top achievements
Rank 1
answered on 05 Jul 2013, 11:08 AM
Hi Shinu,

I have RadWindowManager on my modal window.
<telerik:RadWindowManager ID="WindowManager" runat="server">
    </telerik:RadWindowManager>

if I use
radalert('Data Saved successfully', 330, 100, 'Client RadAlert', null);
 on a normal page this works, but on a modal RadWindow it fails.

Thanks
Tripati

0
Accepted
Marin Bratanov
Telerik team
answered on 05 Jul 2013, 11:36 AM
Hi guys,

The most likely reason for such an error is the timing of the script execution. It needs to be in the Sys.Application.Load event as shown in this sticky thread and this help article, because at any earlier point the RadWindowManager control is not initialized yet.


Regards,
Marin Bratanov
Telerik
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 the blog feed now.
0
Tripati
Top achievements
Rank 1
answered on 05 Jul 2013, 11:59 AM
Hi Marin,

Many thanks for the answer. It is working now.

Regards
Tripati Patro
Tags
Window
Asked by
Tripati
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Tripati
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or