Reputation: 809
I try to publish a C#/ASP.NET page and receive the following error message:
Control XXX must be placed inside a form tag with runat=server
When I add the <form runat="server">
tag, I receive the following error:
A page can have only one server-side Form tag.
I know that my master page has the runat=server
form tag and that the content is encompassed within that tag. I also see that the error appears to be occuring within
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\a05ad405\1aeb0277\App_Web_lgjjhruj.3.cs:0
which is I suppose a temporary file?
My question is, has anyone had a similar error and how was it resolved?
Upvotes: 1
Views: 179
Reputation: 6190
Keep Only one in master page Remove all the form tag from content page, as well as head and body tag from content page.
and most importantly keep all the controls inside the content place holder that will be rendered inside form tag.
put run at server in all asp controls.
Upvotes: 1
Reputation: 25081
Check your MasterPage and make sure all controls with a runat="server"
are contained within the <form runat="server">
element.
Upvotes: 0
Reputation: 5638
Do you have another form inside of your content page (which uses your master page)? You should have a form which runs at server only in your masterpage. Search your project (ctrl + shift + f) for
Upvotes: 0