【发布时间】:2012-10-15 19:18:59
【问题描述】:
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>
【问题讨论】:
-
你怎么知道它没有触发?另外,如果你注释掉页面上的验证器控件会发生什么?您能否检查以确保此 HTML 没有嵌套在默认 ASP.Net 站点放置在页面上的默认
form元素中? -
ya 它嵌套在一个表单标签中,该标签具有 runat="server" 属性,如果我在此表单中包含 runat="server" ,则会出现这样的错误 --> 页面可以只有一个服务器端 Form 标签。那我该怎么办???
-
删除您声明的
form标记,只需在母版页中使用普通的form标记(或在页面的DOM 中更高)。使用 ASP.Net 网络表单,您无需添加更多form标记。
标签: asp.net