Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Controls
 

Declaring List Items

The ListItem control supports the following five properties: Attributes: attributes of a list item. Enabled:    disable or enable a list item. Selected:   mark as selected. Text:       text displayed by the list item. Value:      specify a hidden value associated with the list item. <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>Favorite Product</title> </head> <body>     <form id="form1" runat="server">     <div>     <asp:Label         id="lblProducts"         Text="Favorite Product:"         AssociatedControlID="rblProducts"         Runat="server" />     <asp:RadioButtonList         id="rblProducts"         Runat="server">         <asp:ListItem             Text="The Remains of the Day"             Value="product1" />         <asp:ListItem             Text="Star Wars"             Value="product2" />         <asp:ListItem             Text="Pulp Fiction"             Value="product3" />     </asp:RadioButtonList>     </div>     </form> </body> </html>