locked
open the modal open for errors asp: ValidationSummary RRS feed

  • Question

  • User-2005128414 posted

    Good afternoon,
    I am building a form of e-mailing.
    I create the part of asp: ValidationSummary and want only opens the modal form is open to errors in the asp: ValidationSummary.

    <ajaxToolkit:ModalPopupExtender 
        ID="MPErros" 
        runat="server" 
        TargetControlID="btEnviar"
        PopupControlID="ModalErros" 
        DropShadow="false" 
        CancelControlID="BotaoCancelar"/>
    
    
                        
    
    <asp:Panel ID="ModalErros" runat="server" Style="display:none;" CssClass="modal">
                                
        <asp:ValidationSummary
            ShowMessageBox="False"
            ID="VS_Consultas"
            runat="server"
            DisplayMode="List"
            ValidationGroup="Erro" />                    
                            
            <asp:LinkButton 
                ID="BotaoCancelar" 
                runat="server"
                CssClass="close"
                CausesValidation="false">
                                    
                <img src="Imagens/fechar.png" runat="server" title="Fechar" style="text-align:center;" />
    
            </asp:LinkButton>
                           
    </asp:Panel>


    When there is no error in the ValidationSummary it opens the modal open but without the errors but I do not want that to happen

    Monday, March 9, 2015 10:27 AM

All replies

  • User61956409 posted

    Hi,

    Thanks for your post.

    You could try to use jQuery Dialog to show ValidationSummary in dialog window.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <asp:TextBox ID="txtname" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtname" ErrorMessage="Please enter your Name!"></asp:RequiredFieldValidator>
                <br />
                <asp:TextBox ID="txtpwd" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtpwd" ErrorMessage="Please enter your PassWord!"></asp:RequiredFieldValidator>
    
                <asp:Panel ID="Panel1" runat="server">
                    ValidationSummary:
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                </asp:Panel>
                <br />
                <asp:Button ID="btnok" runat="server" Text="OK" />
    
            </div>
        </form>
    </body>
    </html>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css" />
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    
    <script>
        $(function () {
            $("#Panel1").hide();
            $("#btnok").click(function () {
    
                $("#Panel1").dialog();
                $("#Panel1").show();
    
            })
        })
    </script> 
    

    Best Regards,

    Fei Han

    Tuesday, March 10, 2015 5:40 AM
  • User-2005128414 posted

    good, thanks for the help. But when I fill the fields all rights without error appears "close" but I did not want it to appear. as follows in the picture sending.

    Image and video hosting by TinyPic

    Tuesday, March 10, 2015 5:55 AM