Setting multiple items as selected in a ListBox with c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waldedg
    New Member
    • Feb 2008
    • 3

    #1

    Setting multiple items as selected in a ListBox with c#

    I have a ListBox set as Multiselect. I am populating the table thruough asp.net code. But I am using another dataset to get the items that should be selected. The only item that ends up selected is the last item in the dataset. The code I am using for setting the selected items is:

    DataSet ds1 = SqlHelper.Execu teDataset(ConnS tr, "StoredProd ", Parm);

    lbRequestTime.S electionMode = ListSelectionMo de.Multiple;

    foreach (DataRow row in ds1.Tables[0].Rows)
    {
    lbRequestTime.S electedValue = row["PerfTimeId "].ToString();
    }

    Any help on how to get the Mulitple selected items selected would be great.
    Doug
Working...