1
Answer

change DropDownCheckboxes property SelectBoxCaption dynamic

User107

User107

8y
612
1

When user select multiple values from DropDownCheckboxes, and How can you show the selected values at the SelectBoxCaption.

How can i do it.

my .aspx code:

<%@ Register Namespace="Saplin.Controls" Assembly="DropDownCheckBoxes" TagPrefix="asp"%> 
<asp:DropDownCheckBoxes ID="dropdown1" runat="server" UseSelectAllNode="true"
UseButtons="true" OnSelectedIndexChanged="dropdown1_SelectedIndexChanged"
AutoPostBack="true"><Style DropDownBoxBoxWidth="200"/> </asp:DropDownCheckBoxes>

.cs

protected void dropdown1_SelectedIndexChanged(object sender, EventArgs e)
 {
 List<String> checkedList = new List<string>();
 foreach (ListItem item in dropdown1.Items)
 {
if (item.Selected)
 {
checkedList
.Add(item.Text);
 }
}
dropdown1
.Texts.SelectBoxCaption = String.Join(",", checkedList);
}

Can anyone help me

Thank you



Answers (1)