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
110
$find not working, I get 'Error: 'dialog' is null or not an object'
posted

I think I'm doing this right, but... not working.

 

I have a master page, and the master includes an ascx control.  In this ascx control, I have the following code:

 

<asp:UpdatePanel ID="uplTimeout" runat="server">
    <ContentTemplate>
        <ig:WebDialogWindow ID="wdwTimeout" runat="server" Height="300px" Width="400px" InitialLocation="Centered" WindowState="Hidden">
           <ContentPane>
            <Template>
                <script type="text/javascript">

                    function setDialogTimer() {
                        var t = setTimeout('showDialog', 5000);
                    }

                    function showDialog() {
                        var dialog = $find('<%= wdwTimeout.ClientId %>');
                        dialog.show();
                    }

                    setDialogTimer();

                    var dialog = $find('<%= wdwTimeout.ClientId %>');
                    dialog.show();
                   
                </script>
               
                Click to extend session.<br />
               
                <asp:Button ID="btnExtend" runat="server" Text="Yes" />
               
            </Template>
           </ContentPane>
        </ig:WebDialogWindow>
    </ContentTemplate>
</asp:UpdatePanel>

 

The code above does not represent what I'm actually trying to do, but what I'm trying to do now to see if I can get it to work, in practice, the last two lines would be gone from the script.  However, that is where I get an error that it is not finding the WebDialogWindow

  • 3115
    Offline posted

    Hi,

    I'm not really sure what you are trying to do. But I will suggest the following:

    1. Move script block outside the control

    2.Change dialog var to

    var

     

     

    dialog = $find("wdwTimeout");

    if you use master pages the ID of the control will be changed, so you won't be able to find it. There is two solutions to that problem.

    a) To debug your site/Application and see using FireBug or IEDevelopers, to see the ID (usually is changed to ctl100_something_ID of the control) - then copy and paste it to find above.

    b) If you use CLR4 there is Property of the control named: ClientIdMode. If you set:

    ClientIDMode

     

     

    ="Static"

    That will not change the ID no matter you use Content Place Holders.

    Hope that helped