1

asp 按钮 onclick 事件未触发, button(id="submit") 有一个 onclick 事件 (Submit_Click) ,单击时未触发。为什么???

<form enctype="multipart/form-data" method="post" action="javascript:;">
    <div class="content">
        <p>
            I am a returning customer</p>
        <b>E-Mail Address:</b><br />

        <asp:TextBox name="email" runat="server" ID="email"></asp:TextBox>
        <asp:RegularExpressionValidator ID="email_validation" runat="server" 
            ControlToValidate="email" ErrorMessage="enter a valid email" ForeColor="Red" 
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
            ValidationGroup="email"></asp:RegularExpressionValidator>
        <br />
        <br />
        <b>Password:</b><br />
        <asp:TextBox runat="server" name="password" TextMode="Password"></asp:TextBox>
        <br />
        <a href="javascript:;">Forgotten Password</a><br />
        <br />
        <asp:Button ID="Submit" runat="server" CssClass="button" Text="Login" 
            onclick="Submit_Click" />
        <input type="hidden" value="http://www.przemyslawlobodzinski.pl/themes/megastore/index.php?route=account/account"
            name="redirect"/>
    </div>
</form>
4

1 回答 1

5

表单缺少runat=server标记。

为了让 asp:Button 触发服务器端事件,它需要采用设置了 runat="server" 属性的表单。这适用于所有服务器控件。( http://www.w3schools.com/aspnet/aspnet_forms.asp )

您的表单似乎正在尝试调用 JavaScript。

于 2012-10-15T19:21:25.027 回答