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
444
Validation Summary in a webDialog?
posted

Hi Guys, how can I popup the webDialog when the page is Not Valid

I have this....

<ig:WebDialogWindow ID="summaryDialog" runat="server" Height="300px"
        Width="400px">
        <ContentPane>
        <asp:ValidationSummary id="summary1" CssClass="validationSummary"
        runat="server" ShowMessageBox="false" ShowSummary="true"
         DisplayMode="BulletList" HeaderText="The following errors where found:" />
        </ContentPane>
    </ig:WebDialogWindow>
 I have a submit button on the page, when it is clicked, if the page is invalid, I want to popup the webDialog with the validationSummary control inside it.

What do I do?

Thanks,

~ck in San Diego

  • 28407
    Suggested Answer
    posted

    Hi,

     Here  is some sample code to do what you want.

     <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <%@ Register assembly="Infragistics35.Web.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.LayoutControls" tagprefix="ig" %>

    <%@ Register assembly="Infragistics35.WebUI.WebDataInput.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.WebDataInput" tagprefix="igtxt" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>

        <script type="text/javascript" >
    <!--


    function button_click() {
    //debugger;
        var window = $find('<%= WebDialogWindow1.ClientID %>');
      if (Page_IsValid)
      {
     
      window.hide();
      }
      else window.show();
    }
    // -->
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:TextBox ID="TextBox1" runat="server" CausesValidation="True"
                ValidationGroup="group1"></asp:TextBox>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                ControlToValidate="TextBox1" Display="None"
                ErrorMessage="RequiredFieldValidator " ValidationGroup="group1">required
            field</asp:RequiredFieldValidator>
            <asp:Button OnClientClick="button_click()" ID="Button1" runat="server" Text="Button"
                ValidationGroup="group1" />
            <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px"
                Width="400px" WindowState="Hidden">
                <ContentPane>
                    <Template>
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server"
                            ValidationGroup="group1" />
                    </Template>
                </ContentPane>
            </ig:WebDialogWindow>
          
       
        </div>
        </form>
    </body>
    </html>