Reputation: 443
<div id="formContainer">
<form id="login" runat="server">
<a href="#" id="flipToRecover" class="flipLink">Forgot?</a>
<asp:TextBox ID="loginEmail" Text="Email" runat="server"></asp:TextBox>
<asp:TextBox ID="loginPass" TextMode="Password" runat="server" value="pass"></asp:TextBox>
<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
</form>
<form id="recover" method="post" action="./">
<a href="#" id="flipToLogin" class="flipLink">Forgot?</a>
<input type="text" name="recoverEmail" id="recoverEmail" value="Email" />
<input type="submit" name="submit" value="Recover" />
<%-- <asp:Button ID="btnrecover" runat="server" Text="Recover" OnClick="btnrecover_Click" />--%>
</form>
</div>
This is my code and I need to write a code on recover button. But error came that is only one form is used.
Can anyone help to solve this error?
I want to write code on both buttons to submit and recover. Thanks.
Upvotes: 0
Views: 207
Reputation: 492
There is another way, you can extend your first form to Control, then you can see it on your Toolbox. Then just drag it to your second Form.
Upvotes: 0
Reputation: 6103
You can use Panel control
instead of form ,
<div id="formContainer">
<asp:Panel runat="server" ID="pTest" DefaultButton="btnLogin">
<a href="#" id="flipToRecover" class="flipLink">Forgot?</a>
<asp:TextBox ID="loginEmail" Text="Email" runat="server"></asp:TextBox>
<asp:TextBox ID="loginPass" TextMode="Password" runat="server" value="pass"></asp:TextBox>
<asp:Button ID="btnLogin" runat="server" Text="Login" />
</asp:Panel>
<asp:Panel runat="server" ID="Panel1" DefaultButton="btnrecover">
<a href="#" id="flipToLogin" class="flipLink">Forgot?</a>
<input type="text" name="recoverEmail" id="recoverEmail" value="Email" />
<input type="submit" name="submit" value="Recover" />
<asp:Button ID="btnrecover" runat="server" Text="Recover" />
</asp:Panel>
</div>
You can also reference this link !
Upvotes: 2