我有一個列表框與選擇模式的倍數。在後面的代碼中,我想設置一些選定的值。這些值存在於ListItems [],名爲'Names'。如何在ListBox中設置多個項目?
HTML代碼:
<asp:ListBox ID="lbto" class="chosen" runat="server" Width="450px"
Height="20px" SelectionMode="Multiple">
<asp:ListItem>Mandy</asp:ListItem>
<asp:ListItem>Amit</asp:ListItem>
<asp:ListItem>sundar</asp:ListItem>
<asp:ListItem>ragu</asp:ListItem>
<asp:ListItem>raju</asp:ListItem>
</asp:ListBox>
列表項[]名稱包含'肉醬'和'拉朱'。現在,當頁面加載時,列表框應包含'ragu'和'raju'作爲選定值。
你的答案是單列表項正確.. – ragu 2013-04-11 08:30:43
可以設置多個項目以上述方法「選擇」。更新了答案。 – Carsten 2013-04-11 08:32:17
如果'lbto'包含100個項目意味着,它將檢查整個100個項目。它需要更多時間嗎? – ragu 2013-04-11 08:49:27