ASP.NET ListItem Selected 屬性

定義和用法
Selected 屬性用於設置或返回是否默認地選定 ListItem。
如果該屬性被設置為 TRUE,則 ListItem 被默認地選定,否則為 FALSE。默認是 FALSE。
語法
<asp:ListItem Selected="True|False" runat="server" />
實例
下麵的實例設置了 ListBox 控件中被選定的 ListItem:
<form runat="server">
<asp:ListBox runat="server">
<asp:ListItem Text="Item1" Selected="True"/>
<asp:ListItem Text="Item2" />
</asp:ListBox>
</form>
<asp:ListBox runat="server">
<asp:ListItem Text="Item1" Selected="True"/>
<asp:ListItem Text="Item2" />
</asp:ListBox>
</form>
