Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
$find fails in function called from page onload
posted

I need to show/hide a dialog window on page load based on a cookie value.  The $find function fails with 'null' is null or not an object.

Anyone done this?  It seems like it should be pretty common.

Update after reviewing the forum:  WebDialogWindow.initialize won't run when the design-time windowstate is hidden; and if the design time window state is normal, if i try to hide the window in the initialize function, it still flashes visible briefly before hiding - which is not acceptable behavior.  Thanks in advance.

Parents
No Data
Reply
  • 24497
    posted

    Hi,

    That is correct, the Initialize event is raised after WebDialogWindow and all its subobjects are fully created. WebDialogWindow does a lot of adjustments on client which require offsetWidth/Height and before the first paint, most of child objects are not ready for public access.

    However, instance of hidden dialog should be available within onload event (with some delay; down to 0ms) and some of properties can be modified. As I said, access to particular properties and objects may bring problems, and therefore that is not supported situation.

    Below is example:

    <script type="text/javascript">
    function findDialog()
    {
     
    var dialog = $find("WebDialogWindow1");
     
    if(dialog)
        dialog.set_windowState($IG.DialogWindowState.Normal);
     
    else
        
    alert("dialog not found");
    }
    </script>

    <body onload="setTimeout('findDialog()',0)">
    <
    form id="form1" runat="server">
      <
    ig:WebDialogWindow ID="WebDialogWindow1" runat="server" WindowState="Hidden"></ig:WebDialogWindow>

Children