我正在使用带有c#语言的asp.net。我有一个母版页并连接了一个页面。在母版页上,我已经有一个服务器表单标记,但在连接的.aspx
页面上,一个包含asp按钮的简单表单标记。因此,如果我点击asp按钮,它就不会后端c#代码,这个表单标签会生成一个包含所有输入数据的URL。如果我从.aspx
页面删除该表单标记,则无法点击asp按钮。
我的前端代码是:
<div class="registration_form">
<!-- Form -->
<form>
<div>
<label>
<input placeholder="first name:" id="txtfname" runat="server" type="text" required>
</label>
</div>
<div>
<label>
<input placeholder="last name:" id="txtlname" runat="server" type="text" required>
</label>
</div>
<div>
<label>
<input placeholder="email address:" id="txtemail" runat="server" type="text" required>
</label>
</div>
<div>
<label>
<asp:DropDownList ID="Ddpgender" CssClass="dropdown" runat="server">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:DropDownList>
</label>
</div>
<div>
<label>
<input placeholder="password" id="txtpass" runat="server" type="password" required>
</label>
</div>
<div>
<label>
<input placeholder="retype password" id="txtrpass" runat="server" type="password" required>
</label>
</div>
<div class="sky-form">
<label class="checkbox"><input type="checkbox" name="checkbox" ><i></i>i agree to shoppe.com <a class="terms" href="#"> terms of service</a> </label>
</div>
<div>
<asp:Button ID="bttnsignup" runat="server" Text="Register"
onclick="bttnsignup_Click" />
</div>
</form>