Smitka
Smitka

Reputation: 57

Validation (XHTML 1.0 Transitional): Element 'html' cannot be nested within element 'div'

I need help how to fix the error in my code. When I compile the code told me the error Validation (XHTML 1.0 Transitional): Element 'html' cannot be nested within element 'div'. If someone know, please help me?

 <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManageUsers.aspx.cs" Inherits="probazaadmin.ManageUsers" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form2" runat="server"></form>
    <div>Users Account Management</div>
    <p></p>
    <b>- The total registered users is: <asp:Literal runat="server" ID="lblTotalUsers" /><br />
    - The total online users at this moment: <asp:Literal runat="server" ID="lblOnlineUsers" /></b>
    <p></p>
    In order to display all users whose name begins with letter click on the link letter:
    <p></p>

    <asp:Repeater runat="server" ID="rptAlphabetBar"
    OnItemCommand="rptAlphabetBar_ItemCommand">
    <ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Container.DataItem %>'
    CommandArgument='<%# Container.DataItem %>' />&nbsp;&nbsp;
    </ItemTemplate>
    </asp:Repeater>
    <p></p>
    Use the below feature to search users by partial username or e-mail:
    <p></p>

    <asp:DropDownList runat="server" ID="ddlUserSearchTypes">
    <asp:ListItem Text="UserName" Selected="true" />
    <asp:ListItem Text="E-mail" />
    </asp:DropDownList>
    contains
    <asp:TextBox runat="server" ID="txtSearchText" />
    <asp:Button runat="server" ID="btnSearch" Text="Search"
    OnClick="btnSearch_Click" />
    </body></html>
    </asp:Content>

Upvotes: 1

Views: 12727

Answers (2)

Sanjeev Yadav
Sanjeev Yadav

Reputation: 1

Your code should be like this <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ManageUsers.aspx.cs" Inherits="probazaadmin.ManageUsers" %> Users Account Management

- The total registered users is:
- The total online users at this moment:

In order to display all users whose name begins with letter click on the link letter:

<asp:Repeater runat="server" ID="rptAlphabetBar"
OnItemCommand="rptAlphabetBar_ItemCommand">
<ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Container.DataItem %>'
CommandArgument='<%# Container.DataItem %>' />&nbsp;&nbsp;
</ItemTemplate>
</asp:Repeater>
<p></p>
Use the below feature to search users by partial username or e-mail:
<p></p>

<asp:DropDownList runat="server" ID="ddlUserSearchTypes">
<asp:ListItem Text="UserName" Selected="true" />
<asp:ListItem Text="E-mail" />
</asp:DropDownList>
contains
<asp:TextBox runat="server" ID="txtSearchText" />
<asp:Button runat="server" ID="btnSearch" Text="Search"
OnClick="btnSearch_Click" />
</asp:Content>

Upvotes: 0

EdSF
EdSF

Reputation: 12351

Your code shows you are:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master"....
  1. using a master page (which is where the HTML declaration is)

    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
  2. using the content page placeholder to add and entire HTML document - which you shouldn't do.

    • as stated, the master page is where HTML declarations go
    • ASP.net content sections are for content only.

Upvotes: 3

Related Questions