Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Web Forms element inside element

Tags:

html

asp.net

I have now 3 hours of experience (tryence) in ASP.NET Web Forms. I'm so used to HTML that I need some help to get out of the box.

What I'm trying to do is a simple Element inside Element, but it keeps saying that "the element is not known".

What I need is:

<ul>
  <li>
    <div>TEST</div>
  </li>
</ul>

What I'm trying is:

<asp:BulletedList ID="BulletedList1" runat="server">
    <asp:ListItem>
        <asp:Panel runat="server">TEST</asp:Panel>
    </asp:ListItem>
</asp:BulletedList>

This is not working and I would like to understand why?

like image 778
Oliveira Avatar asked Mar 25 '26 04:03

Oliveira


1 Answers

You cannot add elements inside asp:ListItems, you can only set the Value and Text property of them

<asp:ListItem Text="Test" Value="Test"></asp:ListItem>

There's no real reason you couldn't use standard HTML controls and that will achieve what you want

<ul>
  <li>
    <div id="testDiv" runat="server">TEST</div>
  </li>
</ul>
like image 154
theedam Avatar answered Mar 27 '26 17:03

theedam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!