I always seem to be subclassing the standard .NET web controls and adding my own little features. Here is an enhancement that I made to CheckBoxList:
public String[] SelectedValues
{
get
{
List<String> output = new List<String>();
foreach (ListItem listItem in Items)
if (listItem.Selected)
output.Add(listItem.Value);
return (output.ToArray());
}
}
Now that I have this method I can convert the CheckBoxList to a CSV like this:
String csv = String.Join(",", checkBoxList1.SelectedValues);
{6230289B-5BEE-409e-932A-2F01FA407A92}
No comments:
Post a Comment