Display multiple selected Items from DDL in Label
Posted on 2004-08-04
I have a webform that contains a dropdownlist with a list of users. Later on in the form I have a confirmation panel in which users can confirm the accuracy of their data before submitting. The problem I am having is that the label control is not listing all of the users selected from the dropdownlist control inteh webform.
Here is the code for the ddl:
<asp:listbox id="ActiveUsers" runat="server" SelectionMode="Multiple" Rows="1"></asp:listbox>
Here is the code to populate the control from code-behind:
Conn = new SqlConnection("server=C099450d01;uid=sa;pwd=;database=tools");
Cmd = new SqlCommand("SELECT UID, LastName + ', ' + FirstName AS Name FROM Employee ORDER BY LastName", Conn);
ActiveUsers.DataSource = Cmd.ExecuteReader();
ActiveUsers.DataTextField = "Name";
ActiveUsers.DataValueField = "Name";
Here is the code to populate the Label control in code-behind:
lblActUsr.Text = ActiveUsers.SelectedItem.Value
Can someone tell me why only one selection is appearing in the label control and how I can fix it.