Using different jquery dialog form in the same page
<p>I'm trying to use more than one JQuery dialog form in the same page. One of them work (divEditPeriod) the other doesn't. What am I doing wrong? code bellow:</p>

<pre><code>    $(document).ready(function() {
                $("#divEditPage").dialog({
        autoOpen: false,
        modal: true,
        minHeight: 20,
        height: 'auto',
        width: 'auto',
        resizable: false,
        open: function(event, ui) {
         $(this).parent().appendTo("#divEditPageDlgContainer");
        },
       });

       $("#divEditPeriod").dialog({
        autoOpen: false,
        modal: true,
        minHeight: 20,
        height: 'auto',
        width: 'auto',
        resizable: false,
        open: function(event, ui) {
         $(this).parent().appendTo("#divEditPeriodDlgContainer");
        },
       });

      });

      function closeDialog(Form) {
       //Could cause an infinite loop because of "on close handling"
       $(Form).dialog('close');
      }

      function openDialog(title, linkID, Form) {

       var pos = $("#" + linkID).position();
       var top = pos.top;
       var left = pos.left + $("#" + linkID).width() + 10;


       $(Form).dialog("option", "title", title);
       $(Form).dialog("option", "position", [left, top]);   
       $(Form).dialog('open');
      }



      function openDialogAndBlock(title, linkID, Form) {
       openDialog(title, linkID, Form);

       //block it to clean out the data
       $(Form).block({
        message: '&lt;img src="&lt;%=ResolveUrl("~") %&gt;images/async.gif" /&gt;',
        css: { border: '0px' },
        fadeIn: 0,
        //fadeOut: 0,
        overlayCSS: { backgroundColor: '#ffffff', opacity: 1 } 
       });
      }        

      function unblockDialog(Form) {
       $(Form).unblock();
      }

     }




&lt;div id="divPageDlgContainer"&gt;
                        &lt;div id="divEditPage" style="display: none"&gt;
                            &lt;asp:UpdatePanel ID="upnPage" runat="server"&gt;
                                &lt;ContentTemplate&gt;
                                    &lt;asp:PlaceHolder ID="phrPage" runat="server"&gt;
                                        &lt;table cellpadding="3" cellspacing="1"&gt;
                                            &lt;tr&gt;
                                                &lt;td&gt;
                                                    *Current Page:
                                                &lt;/td&gt;
                                                &lt;td&gt;
                                                    &lt;asp:TextBox ID="txtCurrentPage" Columns="40" MaxLength="50" runat="server" /&gt;
                                                    &lt;asp:RequiredFieldValidator ID="rfvCurrentPage" runat="server" EnableClientScript="false"
                                                        Display="Dynamic" ErrorMessage="Required." ControlToValidate="txtCurrentPage"
                                                        ForeColor="Red" /&gt;
                                                &lt;/td&gt;
                                            &lt;/tr&gt;
                                            &lt;tr&gt;
                                                &lt;td&gt;
                                                    *Previous Page:
                                                &lt;/td&gt;
                                                &lt;td&gt;
                                                    &lt;asp:TextBox ID="txtPreviousPage" Columns="40" MaxLength="50" runat="server" /&gt;
                                                    &lt;asp:RequiredFieldValidator ID="rfvPreviousPage" runat="server" EnableClientScript="false"
                                                        Display="Dynamic" ErrorMessage="Required." ControlToValidate="txtPreviousPage"
                                                        ForeColor="Red" /&gt;
                                                &lt;/td&gt;
                                            &lt;/tr&gt;
                                            &lt;tr&gt;
                                                &lt;td&gt;
                                                    *Next Page:
                                                &lt;/td&gt;
                                                &lt;td&gt;
                                                    &lt;asp:TextBox ID="txtNextPage" Columns="40" MaxLength="50" runat="server" /&gt;
                                                    &lt;asp:RequiredFieldValidator ID="rfvNextPage" runat="server" EnableClientScript="false"
                                                        Display="Dynamic" ErrorMessage="Required." ControlToValidate="txtNextPage" ForeColor="Red" /&gt;
                                                &lt;/td&gt;
                                            &lt;/tr&gt;
                                            &lt;tr&gt;
                                                &lt;td colspan="2" align="right"&gt;
                                                    &lt;asp:Button ID="btnSavePage" OnClick="btnSavePage_Click" Text="Save" runat="server" /&gt;
                                                    &lt;asp:Button ID="btnCancelPage" OnClick="btnCancelPage_Click" OnClientClick="closeDialog('#divEditPeriod')"
                                                        CausesValidation="false" Text="Cancel" runat="server" /&gt;
                                                &lt;/td&gt;
                                            &lt;/tr&gt;
                                        &lt;/table&gt;
                                    &lt;/asp:PlaceHolder&gt;
                                &lt;/ContentTemplate&gt;
                            &lt;/asp:UpdatePanel&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;


&lt;div id="divEditPeriodDlgContainer"&gt;
                    &lt;div id="divEditPeriod" style="display: none"&gt;
                        &lt;asp:UpdatePanel ID="upnlEditPeriod" runat="server"&gt;
                            &lt;ContentTemplate&gt;
                                &lt;asp:PlaceHolder ID="phrEditPeriod" runat="server"&gt;
                                    &lt;table cellpadding="3" cellspacing="1"&gt;
                                        &lt;tr&gt;
                                            &lt;td&gt;
                                                *Start Date:
                                            &lt;/td&gt;
                                            &lt;td&gt;
                                                &lt;asp:TextBox ID="txtStartDate" Columns="40" MaxLength="50" runat="server" /&gt;
                                                &lt;asp:RequiredFieldValidator ID="rfvStartDate" runat="server" EnableClientScript="false"
                                                    Display="Dynamic" ErrorMessage="Required." ControlToValidate="txtStartDate" ForeColor="Red" /&gt;
                                                &lt;asp:RegularExpressionValidator ID="revStartDate" runat="server" EnableClientScript="false"
                                                    ControlToValidate="txtStartDate" ValidationExpression="(([1-9]|1[012])[- /.]([1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d)|((1[012]|0[1-9])(3[01]|2\d|1\d|0[1-9])(19|20)\d\d)|((1[012]|0[1-9])[- /.](3[01]|2\d|1\d|0[1-9])[- /.](19|20)\d\d)"
                                                    ErrorMessage="Not a valid Date." Display="Dynamic" ForeColor="Red" /&gt;
                                            &lt;/td&gt;
                                        &lt;/tr&gt;
                                        &lt;tr&gt;
                                            &lt;td&gt;
                                                *End Date:
                                            &lt;/td&gt;
                                            &lt;td&gt;
                                                &lt;asp:TextBox ID="txtEndDate" Columns="40" MaxLength="50" runat="server" /&gt;
                                                &lt;asp:RequiredFieldValidator ID="rfvEndDate" runat="server" EnableClientScript="false"
                                                    Display="Dynamic" ErrorMessage="Required." ControlToValidate="txtEndDate" ForeColor="Red" /&gt;
                                                &lt;asp:RegularExpressionValidator ID="revEndDate" runat="server" EnableClientScript="false"
                                                    ControlToValidate="txtEndDate" ValidationExpression="(([1-9]|1[012])[- /.]([1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d)|((1[012]|0[1-9])(3[01]|2\d|1\d|0[1-9])(19|20)\d\d)|((1[012]|0[1-9])[- /.](3[01]|2\d|1\d|0[1-9])[- /.](19|20)\d\d)"
                                                    ErrorMessage="Not a valid Date." Display="Dynamic" ForeColor="Red" /&gt;
                                            &lt;/td&gt;
                                        &lt;/tr&gt;
                                        &lt;tr&gt;
                                            &lt;td colspan="2" align="right"&gt;
                                                &lt;asp:Button ID="btnSave" OnClick="btnSavePeriod_Click" Text="Save" runat="server" /&gt;
                                                &lt;asp:Button ID="btnCancel" OnClick="btnCancelPeriod_Click" OnClientClick="closeDialog('#divEditPeriod')"
                                                    CausesValidation="false" Text="Cancel" runat="server" /&gt;
                                            &lt;/td&gt;
                                        &lt;/tr&gt;
                                    &lt;/table&gt;
                                &lt;/asp:PlaceHolder&gt;
                            &lt;/ContentTemplate&gt;
                        &lt;/asp:UpdatePanel&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
</code></pre>
