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()
Using WebDialogWindow 2008.3 CLR 3.5
I've been trying to find a way to show the dialog from code behind... setting the WindowState property on a button click does not show the dialog window. I left the WindowState attribute off of my html tag just to verify. Upon closing the window (with the x) I attempted a partial postback that triggered the panel setting WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal and nothing happens :(
I'm not sure if this is an AJAX issue where the DialogWindow doesn't respond to code changes on a partial postback or if this is a JavaScript issue where the WindowState property isn't properly setting the variable to tell the window to show or not once it has been set.
I know I've run into issues with JavaScript + AJAX where using ClientScript doesn't re-register your scripts, you have to use ScriptManager... This seems vaguely like the issue.
Any other knowledge on this issue would be appreciated.