Reputation: 8644
I am currently trying to make my existing ASP.NET WebForms application use a Site.Master template.
Creating the Site.Master template wasn't really a problem as it works like a charm.
The problem starts with deriving from it and putting controls in the given ContentPlaceHolder's.
At runtime I receive following error message:
Control 'ctr00_Login1' of type 'Login' must be placed inside a form tag with runat=server
This comes from the LoginControl I put in the Site.Master template.
How should I handle this error and what is the best practise for using elements in Master Pages?
Thanks in advance for all help!
Upvotes: 0
Views: 423
Reputation: 29157
Looks like you don't have a form element (<form>
)on your masterpage. Read here to see how masterpages work.
You should have something along the lines of the following (from the MSDN page):
<form id="form1" runat="server">
<table>
<tr>
<td><asp:contentplaceholder id="Main" runat="server" /></td>
<td><asp:contentplaceholder id="Footer" runat="server" /></td>
</tr>
</table>
</form>
Either that or the login control is not inside the <form>
tags.
Upvotes: 3