ListBox created in code-behind displays as DropDownList???
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[i];
rowsList.AutoPostBack = true;
rowsList.EnableViewState = true;
rowsList.ID = "RowsList1";
rowsList.Rows = 1;
rowsList.SelectedIndexChanged += new
rowsList.SelectionMode = ListSelectionMode.Multiple;
rowsList.Width = Unit.Pixel(150);
Re: ListBox created in code-behind displays as DropDownList???
On 2 Mar., 17:52, "DOK" <daphneoke...@hotmail.com> wrote:
> rowsList.Rows = 1;
Try setting this one to 2 or higher. A listbox with a height of 1 and
selectionmode single will be displayed as a dropdownbox. You might be
able to change the height of the rendered control with CSS.
|All times are GMT. The time now is 02:25 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.