为什么我的按钮不触发事件处理程序OnClick?

时间:2019-11-30 08:46:34

标签: c# asp.net .net asp.net-mvc

因此,我尝试创建一个Login按钮,但似乎没有触发,我在事件处理程序BtnLogin_Click中放置了一些断点,但没有达到。

那是为什么?

<div class="container">

    <!-- Outer Row -->
    <div class="row justify-content-center">

        <div class="col-xl-10 col-lg-12 col-md-9">

            <div class="card o-hidden border-0 shadow-lg my-5">
                <div class="card-body p-0">
                    <!-- Nested Row within Card Body -->
                    <div class="row">
                        <div class="col-lg-6 d-none d-lg-block bg-login-image"></div>
                        <div class="col-lg-6">
                            <div class="p-5">
                                <div class="text-center">
                                    <h1 class="h4 text-gray-900 mb-4">Welcome Back!</h1>
                                </div>
                                <form id="loginForm" runat="server" class="user">
                                    <div class="form-group">
                                        <form>
                                            <asp:TextBox TextMode="Email" ID="inputEmail" CssClass="form-control form-control-user" runat="server" placeholder="Enter Email Address..." />
                                        </form>
                                    </div>

                                    <div class="form-group">
                                        <form>
                                            <asp:TextBox TextMode="Password" ID="inputPassword" CssClass="form-control form-control-user" runat="server" placeholder="Password" />
                                        </form>
                                    </div>


                                    <asp:Button ID="LoginBtn" CssClass="btn btn-primary" Text="Login" runat="server" OnClick="BtnLogin_Click" />

                                </form>

                                <hr>
                                <div class="text-center">
                                    <a class="small" href="Register.aspx">Create an Account!</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>

</div>

还有CS

protected void BtnLogin_Click(object sender, EventArgs e)
{
    //Doesnt reach this
}

0 个答案:

没有答案