<asp:ListBox SelectionMode="multiple" runat="server" ID="languages"> </asp:ListBox>
<div> <asp:ListBox ID="ListBox1" runat="server"> <asp:ListItem Value="One" /> <asp:ListItem Value="Two" /> <asp:ListItem Value="Three" /> <asp:ListItem Value="Four" /> <asp:ListItem Value="Five" /> </asp:ListBox> </div>
protected void Page_Load(object sender, EventArgs e) { ListBox1.SelectionMode = ListSelectionMode.Multiple; for (int i = 0; i < ListBox1.Items.Count; i++) { if(i == 0 || i == 2 || i == 4) { ListBox1.Items[i].Selected = true; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)