我试图点击一个具有onclick功能的ASP:按钮。每次我这样做时,HTML5 Required都会停止发生点击。我甚至试图包含一个ASP:UpdatePanel,但这两个都不起作用。
<form id="form1" name="theform" class="form-horizontal" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="fb_login" runat="server">
<asp:button CssClass="btn-facebook" ID="FacebookButton" Text="Login with Facebook" OnClick="FacebookButton_Click" runat="server" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="container">
<div class="form-group">
<label for="FirstName">First Name</label>
<div>
<input type="text" tabindex="1" class="form-control" id="FirstName" required title="Enter First Name" runat="server" placeholder="First Name">
</div>
</div>
<div class="form-group">
<label for="LastName">Last Name</label>
<div>
<input type="text" tabindex="2" class="form-control" id="LastName" required title="Enter Last Name" runat="server" placeholder="Last Name">
</div>
</div>
<div class="form-group">
<div>
<button type="submit" class="btn btn-primary">Submit Information</button>
</div>
</div>
</div>
</form>
答案 0 :(得分:1)
删除UpdatePanel并在FacebookButton上设置UseSubmitBehavior="false"
:
<asp:button UseSubmitBehavior="false" CssClass="btn-facebook" ID="FacebookButton" Text="Login with Facebook" OnClick="FacebookButton_Click" runat="server" />