ASP.NET Selected 屬性
定義和用法
Selected 屬性用于設(shè)置或返回是否默認(rèn)地選定 ListItem。
如果該屬性被設(shè)置為 TRUE,則 ListItem 被默認(rèn)地選定,否則為 FALSE。默認(rèn)是 FALSE
語(yǔ)法
<asp:ListItem Selected="True|False" runat="server" />
實(shí)例
下面的例子設(shè)置了 ListBox 控件中被選定的 ListItem:
<form runat="server">
<asp:ListBox runat="server">
<asp:ListItem Text="Item1" Selected="True"
/>
<asp:ListItem Text="Item2" />
</asp:ListBox>
</form>
實(shí)例
- 設(shè)置 ListBox 控件中被選定的 ListItem