How to put controls within different content placeholder without using form

asp.net

Situation: I have a master page which has 3 content place holder but no form runat server.
In my Login.aspx I try to fill those place holders but it does't allow me without form runat server tag and once I add more than one form again it shows me :"A page can have only one server-side Form tag."

here is my code :

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DWDS_Lotus_Care_Final.Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <form id="formUser" runat="server">
            <p>
                <asp:Label ID="lblUsername" runat="server" Text="Username"></asp:Label>
                <asp:Button ID="btnLogout" runat="server" Text="Logout" />
            </p>
    </form>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
    <table style="width: 100%">
        <tr>
            <td style="width: 93px">
                UserName :
            </td>
            <td style="width: 139px">
        <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>
            </td>
            <td style="width: 307px">
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtUserName" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 93px">
                Password :</td>
            <td style="width: 139px">
        <asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
            </td>
            <td style="width: 307px">
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtPassword" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 93px">
                &nbsp;</td>
            <td style="width: 139px">
        <asp:Button ID="btnSubmit" Text="Submit" runat="server" 
            onclick="btnSubmit_Click" />
        &nbsp;&nbsp;
        <asp:Button ID="btnClear" Text="Clear" runat="server" 
            onclick="btnClear_Click" />
            </td>
            <td style="width: 307px">
        <asp:LinkButton ID="linkRegister" Text="Register" runat="server"></asp:LinkButton>
            </td>
        </tr>
    </table>
        </p>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">

</asp:Content>

here is the master source

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs"     Inherits="DWDS_Lotus_Care_Final.Site1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <title>Consistent</title>
    <link href="http://fonts.googleapis.com/css?family=Bitter" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
        <div id="wrapper">
        <div id="header">
            <div id="logo">

            </div>
        </div>
            <div id="menu">
                <ul>
                    <li><a href="#">Login</a></li>
                    <li><a href="#">About</a></li>
                    <li><a href="#">Portfolio</a></li>
                    <li class="last"><a href="#">Contact</a></li>
                </ul>
            </div>
            <div id="page">



        <%--Here is the sidebar--%>
            <div id="sidebar" style="background-color:#CCCCCC">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
                </asp:ContentPlaceHolder>
                    <h3>Links to Other Hospitals</h3>
                    <div class="date-list">
                        <ul class="list date-list">
                            <li class="first"><span class="date">Sunway</span> <a href="#">Sunway Piramid</a></li>
                            <li><span class="date">KPJ</span> <a href="#">Kajang Care Centre</a></li>
                            <li><span class="date">HCC</span> <a href="#">Health Care Center</a></li>
                            <li><span class="date">AlphaH</span> <a href="#">Alpha Health Center</a></li>
                            <li><span class="date">UPC</span> <a href="#">Bangsar Hospital</a></li>
                            <li class="last"><span class="date">TPM</span> <a href="#">Technology Park Hospital</a></li>
                        </ul>
                    </div>
                <br class="clearfix" />
            </div>



            <%--Here is the Content--%>
            <div id="content">
                <h2>Welcome to Lotus Care</h2>

                <div class="box">
                     <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

                     </asp:ContentPlaceHolder>
                </div>
                <div class="box">
                    <asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">

                     </asp:ContentPlaceHolder>
                </div>
                <br class="clearfix" />
            </div>





            <br class="clearfix" />
        </div>
    </div>
    <div id="footer">
        </div>
</body>

Best Answer

MasterPage:

<form runat="server">
   <%-- use form tag only in Master page.--%>
 <div id="content">
 <h2>Welcome to Lotus Care</h2>
 <div class="box">
  <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

  </asp:ContentPlaceHolder>
  </div>
  <div class="box">
  <asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">

  </asp:ContentPlaceHolder>
  </div>
  <br class="clearfix" />
 </div>
</form>

Content Page:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <%-- don't use Form tag here..--%>
  <table style="width: 100%">
  </table>
</asp:Content>
Related Topic