locked
The 'Text' property of 'asp:ListItem' does not allow child objects. RRS feed

  • Question

  • User1706605676 posted
    Line 30:                         <asp:BulletedList runat="server">
    Line 31:                             <asp:ListItem>
    Line 32:                                 <asp:HyperLink runat="server" NavigateUrl="~/Default.aspx" Text="Add Asset" />
    Line 33:                             </asp:ListItem>
    Line 34:                         </asp:BulletedList>

    Well, why not? The following is perfectly legal HTML:

    <ul>
    <li><a href="/Default.aspx">Add Asset</a></li>
    </ul>



    Wednesday, January 8, 2014 7:10 PM

Answers

  • User533502567 posted

      <asp:BulletedList runat="server">
    Line 31:                             <asp:ListItem>
    Line 32:                                 <asp:HyperLink runat="server" NavigateUrl="~/Default.aspx" Text="Add Asset" />
    Line 33:                             </asp:ListItem>
    Line 34:                         </asp:BulletedList>

    You can set DisplayMode property, if you want links in BulletedList..

    <asp:BulletedList ID="BulletedList1" runat="Server" DisplayMode="HyperLink">
        <asp:ListItem Text="Add Asset" Value="Default.aspx></asp:ListItem>
    </asp:BulletedList>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 8, 2014 7:49 PM

All replies

  • User-1716253493 posted

    Asp.net control allow you to manipulate it easily in server side code.

    Wednesday, January 8, 2014 7:17 PM
  • User533502567 posted

      <asp:BulletedList runat="server">
    Line 31:                             <asp:ListItem>
    Line 32:                                 <asp:HyperLink runat="server" NavigateUrl="~/Default.aspx" Text="Add Asset" />
    Line 33:                             </asp:ListItem>
    Line 34:                         </asp:BulletedList>

    You can set DisplayMode property, if you want links in BulletedList..

    <asp:BulletedList ID="BulletedList1" runat="Server" DisplayMode="HyperLink">
        <asp:ListItem Text="Add Asset" Value="Default.aspx></asp:ListItem>
    </asp:BulletedList>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 8, 2014 7:49 PM
  • User1706605676 posted

    Thanks :)

    That did the trick I was looking for

    Wednesday, January 8, 2014 8:10 PM