I have the need to show a popup when the page is load. I could do this with the Microsoft popup control as it has the ability to call the show function from the codebehind like this:
oPopup.Show();
The WebDialogWindow seems to only be fired from javascript.
I tried adding the javascript to the body tag:
<body onload="modalshow('sControlID');">
but this does not work.
My Javascript is defined as:
var oWebDialogWindow = null;
{
oWebDialogWindow = $find(sControlID);
oWebDialogWindow.show();
}
oWebDialogWindow always comes back as null.
How can I do a show triggered from a postback?
The dialog will come back as null for one of 2 reasons. Either the id is incorrect (the dialog may be nested inside of an INamingContainer), or the more likely cause is that your script is executing before the dialog control has actuall been created on the client side.
I would recommend using the Initialize event of the WebDialogWindow and checking a flag which determines the initial visibility of the control. You can toggle the flag in your "modalShow" function rather than actually showing the dialog window.
I think having a .show method available on the serverside is a very useful shortcut, so I will definitely be forwarding this on to our team as a feature request.
-Tony
BTW, you can also use the WindowState property and set it to "Normal" so that upon postback the dialog is visible. This may be the solution rather than using .Show()