我在表单中使用了一个按钮,而这是来自另一个表单。当按钮在第二个窗体内时,它直接调用页面加载事件而不是按钮点击事件。如果我在第二个表单外面按下按钮,它的调用页面加载方法和按钮单击事件都不会有效。
<form id="form1" runat="server">
<form class="ak-form" method="post" action="#">
<ul class="agileits ">
<li class="agileits">
<input required="" id="txtCustMailId" runat="server" class="text-box-dark agileits " type="text" value="Enter Your Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Enter Your Email';}" name="email" /></li>
<li class="agileits">
<input required="" id="txtCustPass" runat="server" class="text-box-dark agileits " type="password" value="Your Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Your Password';}" name="password" /></li>
</ul>
<div class="ak-btn-cont ak-btn-booking-cont login-btn">
<asp:Button runat="server" class="btn btn-primary agileits button2" CssClass="btn btn-info btnWidth100 btnFont" ID="btnCustLogin" ValidationGroup="CustLogin" Text="Login" OnClick="btnCustLogin_Click" />
<asp:Button runat="server" class="btn btn-primary agileits button2" CssClass="btn btn-info btnWidth100 btnFont" ID="Button2" Text="Forgot Password" OnClick="btnCustLogin_Click1" />
</div>
</form>
</form>
答案 0 :(得分:0)
将两个表单合并为一个表单。
<form id="form1" class="ak-form" method="post" action="#" runat="server">
</form>
如果你不能这样做,因为#form1正在包装整个页面,并且在实现中.ak-form更深入文档,然后尝试将runat =“server”属性添加到第二个表单元素。