the server tag is not wel formed for a label which is inside a datalist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kharthi
    New Member
    • Mar 2012
    • 2

    the server tag is not wel formed for a label which is inside a datalist

    I am encountering the an error that is telling me that the server tag is not well formed for a label which is inside a DataList.

    This is that part of that program having that error:
    Code:
    <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1" 
            RepeatColumns="1" style="margin-right: 0px">
            <ItemStyle Font-Bold="True" Font-Italic="True" Font-Names="Times New Roman" 
                Font-Overline="False" Font-Size="Medium" Font-Strikeout="False" 
                Font-Underline="False" HorizontalAlign="Justify" VerticalAlign="Bottom" />
                <ItemTemplate>
                <a href="#" class="mySprite id<%# ((int)DataBinder.Eval(Container,"ItemIndex")) % 6 + 1%>">  
                  <asp:Label ID="Label5" runat="server" Text="<%# Name %>"></asp:Label>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="TextBox8" runat="server" Text="<%# XPath("Name") %>"></asp:TextBox>
                    <br />
                    <asp:Label ID="Label6" runat="server" Text="<%# City %>"></asp:Label>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="TextBox9" runat="server" Text="<%# XPath("City") %>"></asp:TextBox>
                    <br />
                    <asp:Label ID="Label7" runat="server" Text="<%# Age %>"></asp:Label>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:TextBox ID="TextBox6" runat="server" Text="<%# XPath("Age") %>"></asp:TextBox>
                    <br />
                    &nbsp;&nbsp;&nbsp;
                    <br />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </ItemTemplate>
        </asp:DataList>
    Last edited by Frinavale; Mar 20 '12, 06:43 PM. Reason: Added the question stated in the thread title to the body of the thread. Added code tags to the code snippet.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    It's because of your Eval code.
    Instead of using double quotes (") for class="...", try using single quotes class = ' ....'. Same thing for your Text="" and anywhere else that you have Eval code.

    Comment

    Working...