This project is read-only.

Selecting multiple Items of a WebControl ListBox (aka MultiSelect)

Dec 13, 2012 at 8:11 AM


I've trying to select multiple items of a WebControl Listbox or HTML MulitSelect. I've tried some approaches, but all of them failed.

I defined the control in the ObjectRepository like this:

public CUITe_HtmlList cbxSterileBenchItem = new CUITe_HtmlList("Id=DetailContent_lbSterileBenchItem");

An the WebControl generate this code in HTML:

<select id="DetailContent_lbSterileBenchItem" class="textbox listbox" multiple="multiple" size="3" name="ctl00$DetailContent$lbSterileBenchItem" mandForClose="true">
 <option value="I / S-Nr. 731707-2">I / S-Nr. 731707-2</option>
 <option value="II / S-Nr. 731707-6">II / S-Nr. 731707-6</option>
 <option value="III / S-Nr. 731707-7">III / S-Nr. 731707-7</option>

Can you help me?

Thanks in advance.

Dec 13, 2012 at 9:18 AM
Edited Dec 13, 2012 at 9:19 AM


I've finally found a solution for this problem.

List<string> selected = new List<string>();
selected.Add("I / S-Nr. 731707-2");
selected.Add("II / S-Nr. 731707-6");
selected.Add("III / S-Nr. 731707-7");
page.cbxSterileBenchItem.UnWrap().SelectedItems = selected.ToArray();

Can you add this functionality into CUITe?


Jan 20, 2013 at 2:13 AM

Hi FloopyDoo,

I just checked in code to support this: changeset #23679 added a SelectedItems property wrapper for the CUITe_HtmlList control

Thank you.