I have a login form, and a link that when you press it, the login form becomes a register form using innerHTML. The problem is, that the page won't let me use two forms with runat="server".
Exception Details: System.Web.HttpException: A page can have only one server-side Form tag.
My code looks like this:
<script type="text/javascript">
var str = '<h1>Register:</h1><br>';
str += '<form id="reg" method="post" action="Mainlogin.aspx" runat="server">';
...
function register()
{
document.getElementById('here').innerHTML = str;
}
</script>
<div id="here">
<form id="form1" method="post" action="Mainlogin.aspx" runat="server">
<h1>Please Login:</h1>
</p> <br />
<input type="text" name="username" />
...
<input type="submit" name="login" value="Login"/>
</form>
</div>
Thanks in advance !
No you can have only one runat=server form on the page. if you want, rather than change the form, you could add a hidden field on the page and update that with say 0 or 1 to indicate which option the user picked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.