OK!
I know this has been bugging a lot of you because it's been a real hassle for me. I am using VS 2008 C# to build my web applications. Nearly every one of my pages has the following layout:
<head> ... title, styles, etc.
<script type="text/javascript" language="javascript">
function openDialog(dialog) { dialog.control.show(dialog); }
function openModalDialog(dialog) { dialog.control.showModal(dialog); }
function closeDialog(dialog) { dialog.control.Hide(); }
</script>
<body><form ... ><div><asp:ScriptManager ... ></asp:Scriptmanager><asp:UpdatePanel><ContentTemplate>
..... Page Contents .....
</ContentTemplate></asp:UpdatePanel></div>
.... Multiple C1WebDialogs ....
</form></body>
I use the C1WebDialogs to gather input from users and to display numerous messages. Some of the messages needed to be displayed not as a result of a button push or other client-side event, but because code running on the server determined a message was required. It could be an error message, an informational message, etc.
I tried setting the ShowOnLoad = true, but because of AJAX, this had no affect at all - the dialog stayed hidden.
The Answer!
Use the ScriptManager to call the openDialog script on the form. In your C# (or VB) code where you determine a dialog MUST be displayed, add this (where "dlgError" is the name of your dialog):
ScriptManager.RegisterStartupScript(this, typeof(Page), "onload", "openDialog(dlgError);", true);
You can use this method to run any valid script immediately.
See this page for more information on the method: ScriptManager Class - RegisterStart