开发者

Radwindow OnClientClose firing on open

I have a radwindow which is opened using a javascript function as follows. However, when the radwindow pops up, the alert is displayed.

function OpenRadWindow() 
{
   var oManager = GetRadWindowManager();
   var oMailWnd;
   oMailWnd = window.radopen("MyModal.aspx");
   oMailWnd.set_ti开发者_高级运维tle("Modal Window");
   oMailWnd.OnClientClose = HideActions();
   oMailWnd.set_modal(true);
}

function HideActions() {
   alert("Window Closed");
}

I have not been able to find anywhere that sets OnClientClose inside javascript. Could someone tell how to do this?


This line:

oMailWnd.OnClientClose = HideActions();

is wrong. If you want to add a closing handler to the RadWindow object, you should use the client-side API

e.g.

oMailWnd.add_close(HideActions);

Also, if you are going to show the window multiple times and you haven't set DestroyOnClose=true, I would suggest to clear the closing handler in the closing function in order to avoid stacking:

function HideActions(sender) {
    //remove the handler
    sender.remove_close(HideActions);
    //your code 
    alert("Window Closed");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜