views:

87

answers:

1

Hello Everybody!

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!

+3  A: 

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.

RichardOD
In addition, the form tags should be removed from the child pages (or have the runat="server" part removed).
Jason Berkan
thanks a lot! this one helped me out! does it matter which id value I assign to that form?
Shaharyar