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
1100
WebDialogWindow fails to display after adding a RequiredFieldValidator control
posted

 

I am using a WebDialogWindow to allow the user to input data to my application.

I'm having a problem when I add a RequiredFieldValidator control to the ContentPane - when I do, the WebDialogWindow no longer displays.

The WDW is in an UpdatePanel, and works fine (here is an example of my WDW)

This behavior is the same in FireFox and IE7.

 

Working WDW:

<cc1:WebDialogWindow ID="MyDialog" runat="server" Height="300px"

    Width="400px" WindowState="Hidden" InitialLocation="Centered" Modal="True"

        Moveable="False" CssClass="dialogForm" >

    <Header CaptionText="Add a Device" />

    <ContentPane>

        <Template>

            <div >

            <br />

            <asp:Label ID="Label1" runat="server" Text="IP Address:"></asp:Label>

            <asp:TextBox ID="IP_Addr_TextBox" runat="server"></asp:TextBox>

            <br />

            <asp:Label ID="Label2" runat="server" Text="Name:"></asp:Label>

            <asp:TextBox ID="Name_TextBox" runat="server"></asp:TextBox>

            <br />

            <asp:Label ID="Label3" runat="server" Text="Model:"></asp:Label>

            <asp:DropDownList ID="Model_DropDownList" runat="server">

            </asp:DropDownList>

            <br />

            <asp:Button ID="ButtonOK" runat="server" Text="OK" onclick="ButtonOK_Click" />

            <asp:Button ID="ButtonCancel" runat="server" C***alidation="False"

                    Text="Cancel" oncommand="ButtonCancel_Command" />

            </div>

        </Template>

    </ContentPane>

</cc1:WebDialogWindow>

 

By simply adding a

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"

                                ErrorMessage="RequiredFieldValidator" ControlToValidate="IP_Addr_TextBox" />

 

makes not only this WebDialogWindow fail to display, but also affects my other WDW onthis page -

 

What is causing this? Any ideas? I really want to use asp:RequiredFieldValidator on my dialog.

 

  • 24497
    posted

    Hi Mike,

    I did following tests (you can reproduce that as well):

    1. Created page, added to it UpdatePanel, added a Button to its ContentTemplate and copied your codes for dialog next to button.
    2. On button click I called
      this.MyDialog.WindowState = DialogWindowState.Normal;
    and it worked ok.
    3. I added block of codes with your validator, and dialog did not appear any more.

    After that I did following:

    1. Replaced tags of WebDialogWindow by asp:Panel, so, content of dialog became content of panel.
    2. To mimic initial hidden state of dialog I added display attribute:
      <asp:Panel ID="Panel1" runat="server" style="display:none;">
    3. On button click in order to show panel, I replaced state-change of dialog by
      this.Panel1.Style.Add(HtmlTextWriterStyle.Display, "");
    4. When I ran that, then failure was exactly the same as failure with dialog.
    5. When I removed validator from panel, then it worked correctly.

    I think there is a bug (or limitation to use, or special rules with validation groups) for combination of UpdatePanel with validators. WebDialogWindow is not able to get around that.