Is there a way to open WebDialogBox from the server side?

6 replies. Last post: January 31, 2010 9:03 PM by Hamdy Ghanem
Tags :
Mark DragomMember

Hello,

I have requirement to display messages inside WebDialogBox. Messages are result of server processing. I need to call WebDialogBox from server side. Is it possible? If yes please provide sample code. There are many client side samples but not for server side.

Thanks for any advice.

  

All Replies

Yudi Member

You can set the value of “ShowOnLoad” property to “true” in server side event in order to show WebDialogBox from server side event and vice versa.
I enclosed one simple sample that shows how to show WebDialogBox on ASP.NET button click event.

Hope this helps.

Thanks Yudi,

Your sample works fine outside  Ajax UpdatePanel. Is the there a way to invoke Dilog box without full page postback?

Yudi Member

It is do-able to invoke WebDialogBox without full page postback using ASP.NET AJAX UpdatePanel.

The trick is to add an “end request” handler to the request manager using:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

where EndRequestHandler will be the handler function. In this function, you can simply use ShowDialog() method.

function EndRequestHandler(sender, args) {
    if (args.get_error() == undefined) {
        var dlgBox = ISGetObject("dlgBox");
        dlgBox.ShowDialog();
    }
    else
        alert("There was an error" + args.get_error().message);
}

I enclosed the modified sample to be tested on your end. Hope this help.

Thanks Yudi for your suggestion, but there is still a problem. I'm using your example. It works when the page loads first time. Then after  closing DialogBox and attempting to open again I'm getting  Error "Invalid argument". I'm not sure if its only me or you can replicate that issue on side as well. And maybe you know the fix?

Thanks again

 

Yudi Member

I was unable to repro the “invalid argument” error message issue on my end after attempting to re-open WebDialogBox again, but I got layout issue.
I modify the sample, so that now it uses WebFlyPostBackManager instead of ASP.NET ScriptManager and UpdatePanel. Please check and test the sample and let us know whether it helps or not.

*edited double post in multiple thread. Please see click here for the solutions.

All times are GMT -5. The time now is 3:51 AM.
Previous Next