As the error says, you are only allowed to use one server-side form tag on an ASPX page.
There is nothing stopping you from having other form tags on the same page, as long as they aren't runat="server" ... and nested form tags also are a bit of a taboo - they work in some browsers, and fail miserably in others (yes, IE we're pointing at you!).
Have a look at your master and their related templates..
You don't have to surround the contact form macro with the <form runat="server"> tag. It is already in the user control (usercontrols/cultivcontactform.aspx). You might want to try to remove the <form> tags from cultivcontactform.aspx or (if you don't need them) from your master pages.
i have the same issue - when i remove the form tags from cultivcontactform.aspx i get:
Control
'ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ContentPlaceHolder_CultivContactForm_2__contactName'
of type 'TextBox' must be placed inside a form tag with runat=server
The textbox control needs to be inside a form tag with the attribute runat="server". I would remove the other form tag (without the runat="server attribute) and just have everything inside the <form runat="server"> tag. If that is a problem check this blog post - http://www.frederikvig.com/2009/06/using-multiple-forms-on-an-asp-net-web-forms-page/.
In what ContentPlaceHolder are you adding the _cultivContactForm? If it is the one with the id of ContentPlaceHolder, remove the form in cultivcontactform.aspx.
If you use another ContentPlaceHolder control make sure that the Contentwindow form contains that ContentPlaceHolder control as well, before removing the _cultivContactForm.
<!-- Note also that I removed the self closing /> on the form since we're closing it below --> <form runat="server ID="Contentwindow"> <asp:ContentPlaceHolder runat="server" ID="ContentPlaceHolder"> </asp:ContentPlaceHolder> </form>
Thanks Frederik, for giving support while I was unaware of the questions here! I have just found out that each forum has it's own RSS feed, so I can keep track on new questions in the support forums.
Anyway, you've explained it well. I've just tested to make sure that either method works, and it sure does!
Error on use - A page can have only one server-side Form tag
Hi,
When I publish the page with the contact form and navigate to it, I get this error:
Where can I have double Form tags in this case?
Thanks!
As the error says, you are only allowed to use one server-side form tag on an ASPX page.
There is nothing stopping you from having other form tags on the same page, as long as they aren't runat="server" ... and nested form tags also are a bit of a taboo - they work in some browsers, and fail miserably in others (yes, IE we're pointing at you!).
Have a look at your master and their related templates..
You don't have to surround the contact form macro with the <form runat="server"> tag. It is already in the user control (usercontrols/cultivcontactform.aspx). You might want to try to remove the <form> tags from cultivcontactform.aspx or (if you don't need them) from your master pages.
Let me know if I can help!
Hi,
i have the same issue - when i remove the form tags from cultivcontactform.aspx i get:
Control 'ctl00_ctl00_ctl00_ContentPlaceHolderDefault_ContentPlaceHolder_CultivContactForm_2__contactName' of type 'TextBox' must be placed inside a form tag with runat=server
what should i do?
greetz
Sewi
Hi
The textbox control needs to be inside a form tag with the attribute runat="server". I would remove the other form tag (without the runat="server attribute) and just have everything inside the <form runat="server"> tag. If that is a problem check this blog post - http://www.frederikvig.com/2009/06/using-multiple-forms-on-an-asp-net-web-forms-page/.
Hope this helps.
Hi Frederik,
i don't know which other form tag you mean.
I have one form tag in my master-template
and one in the cultivcontactform.aspx
which should i remove?
In what ContentPlaceHolder are you adding the _cultivContactForm? If it is the one with the id of ContentPlaceHolder, remove the form in cultivcontactform.aspx.
If you use another ContentPlaceHolder control make sure that the Contentwindow form contains that ContentPlaceHolder control as well, before removing the _cultivContactForm.
Example:
Should be:
Basically make sure you only have one form with the runat="server" attribute! :).
Hope this helps.
Thanks Frederik, for giving support while I was unaware of the questions here! I have just found out that each forum has it's own RSS feed, so I can keep track on new questions in the support forums.
Anyway, you've explained it well. I've just tested to make sure that either method works, and it sure does!
Thanks Frederik,
thats it!
I got it work - really nice work
is working on a reply...