D
DOK
I am dynamically creating a series of ListBoxes and populating them in
code-behind. If I set the SelectionMode to single, the controls render
as DropDownLists, which is not what I want. If I change the
SelectionMode to Multiple, I get the ListBox that I want.
Is there a way to force the ListBox to appear as a ListBox? It's
declared as a ListBox, but what I'm getting is a DropDownList.
Here's an example of the code I'm using to set the ListBox properties:
ListBox rowsList = (ListBox)lists;
rowsList.AutoPostBack = true;
rowsList.EnableViewState = true;
rowsList.ID = "RowsList1";
rowsList.Rows = 1;
rowsList.SelectedIndexChanged += new
EventHandler(RowsList_Click);
rowsList.SelectionMode = ListSelectionMode.Multiple;
rowsList.Width = Unit.Pixel(150);
code-behind. If I set the SelectionMode to single, the controls render
as DropDownLists, which is not what I want. If I change the
SelectionMode to Multiple, I get the ListBox that I want.
Is there a way to force the ListBox to appear as a ListBox? It's
declared as a ListBox, but what I'm getting is a DropDownList.
Here's an example of the code I'm using to set the ListBox properties:
ListBox rowsList = (ListBox)lists;
rowsList.AutoPostBack = true;
rowsList.EnableViewState = true;
rowsList.ID = "RowsList1";
rowsList.Rows = 1;
rowsList.SelectedIndexChanged += new
EventHandler(RowsList_Click);
rowsList.SelectionMode = ListSelectionMode.Multiple;
rowsList.Width = Unit.Pixel(150);