使用bootstrap验证特定div

时间:2016-03-28 12:27:00

标签: html5 twitter-bootstrap

我有两个主要的div,一个用于登录其他用于注册。 我想仅在用户单击注册按钮时验证注册div,当用户单击登录按钮时,不应执行注册验证。 这是我的HTML代码。

<form id="form1" runat="server">

            <%--Login div--%>
            <div class="navbar-form navbar-right col-md-9">
                <div class="input-group" style="margin-top: 10px;">
                    <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                    <asp:TextBox ID="txtMobleNoLogin" runat="server" class="form-control" placeholder="Mobile Number"></asp:TextBox>
                </div>
                <div class="input-group" style="margin-top: 10px;">
                    <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                    <asp:TextBox ID="txtPssword" runat="server" class="form-control" placeholder="Password" TextMode="Password"></asp:TextBox>
                </div>
                <asp:Button ID="btnLogIn" runat="server" Text="Login" class="btn btn-primary" OnClick="btnLogIn_Click" Style="margin-top: 9px;" /><br />
                <div class="checkbox">
                    <asp:CheckBox ID="rememberCheckBox" Text="Remember Me" runat="server" ForeColor="White" />
                </div>
                <br />
                <br />
                &nbsp;
            </div>


            <%--Singup div--%>
            <div class="modal fade bs-modal-sm" id="myModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
                <div class="modal-dialog modal-lg">
                    <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">

                        <!-- Div Panel -->
                        <div class="panel panel-primary">

                            <!-- Panel Heading -->
                            <div class="panel-heading">
                                <div class="panel-title" style="text-align: center"></div>
                            </div>
                            <!-- End panel heading -->
                            <!-- Panel body -->


                            <!-- Sing Up -->
                            <div class="panel-body">

                                <!-- FullName -->
                                <div class="input-group input-lastname" style="margin-top: 10px; margin-bottom: 10px;">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                                    <asp:TextBox ID="txtFullName" placeholder="Full Name" runat="server" autocomplete="off" class="form-control" required="required"></asp:TextBox>
                                </div>

                                <!-- Email -->
                                <div class="input-group input-email">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-book"></i></span>
                                    <asp:TextBox ID="txtUserEmail" type="email" placeholder="Email id" runat="server" autocomplete="off" class="form-control" required="required"></asp:TextBox>
                                </div>
                                <!-- Password -->
                                <div class="input-group input-password" style="margin-top: 10px; margin-bottom: 10px;">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                                    <asp:TextBox ID="txtPassword" placeholder="Password" runat="server" autocomplete="off" TextMode="Password" class="form-control" required="required"></asp:TextBox>
                                </div>
                                <!-- ConfirmPassword -->
                                <div class="input-group input-con-password">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                                    <asp:TextBox ID="txtConformPassword" placeholder="conform Password" runat="server" autocomplete="off" TextMode="Password" class="form-control" required="required"></asp:TextBox>
                                </div>
                                <!-- Company-->
                                <div class="input-group input-dropdown" style="margin-top: 10px; margin-bottom: 10px;">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
                                    <div class="dropdown">
                                        <asp:DropDownList ID="ddlCompany" runat="server" CssClass="form-control" DataSourceID="SqlDataSourceCompany" DataTextField="company" DataValueField="company_id" AppendDataBoundItems="True">
                                            <asp:ListItem Value="0">Select Company</asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <!-- Categoery-->
                                <div class="input-group input-dropdown" style="margin-top: 10px; margin-bottom: 10px;">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
                                    <div class="dropdown">
                                        <asp:DropDownList ID="ddlCategoery" runat="server" CssClass="form-control" DataSourceID="SqlDataSourceCategoery" DataTextField="CategoryTitle" DataValueField="CategoryTitle" AppendDataBoundItems="True">
                                            <asp:ListItem Value="0">Select Category</asp:ListItem>
                                        </asp:DropDownList>
                                    </div>
                                </div>
                                <!-- Mobile-->
                                <div class="input-group input-lastname" style="margin-top: 10px; margin-bottom: 10px;">
                                    <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                                    <asp:TextBox ID="txtMobileNo" placeholder="Mobile" runat="server" autocomplete="off" class="form-control" required="required"></asp:TextBox>
                                </div>
                                <!-- Submit-->
                                <div class="form-group login-button">
                                    <div class="col-sm-12 controls">
                                        <div class="col-md-2"></div>
                                        <asp:Button ID="btnSingUp" runat="server" Text="Submit" class="btn btn-primary col-md-3" Style="margin-top: 20px" OnClick="btnSingUp_Click" />
                                        <div class="col-md-2"></div>
                                        <button type="button" class="btn btn-primary col-md-3" data-dismiss="modal" style="margin-top: 20px">Cancel</button>
                                    </div>
                                </div>
                            </div>
                            <!-- End Sing Up -->
                            <div>
                            </div>
                        </div>
                        <!-- ENd form -->
                    </div>
                </div>
                <!-- End panel group -->

            </div>
            <!-- End col div -->
        </form>

0 个答案:

没有答案