encounter item.Selected conversion problem when revamping website
add "$" such as
< option selected= "selected" value= "$6$" > red < / option >
< option value= "$3$" > black < / option >
< option value= "$5$" > blue < / option >
< option selected= "selected" value= "$2$" > White < / option >
< option value= "$4$" > green < / option > <
Save the database code:
string Colors = string.Empty;
foreach (ListItem item in LBColor.Items) {
if (item.Selected) {
Colors += item.Value+" ";
}
}
pro.Colors = Colors.Trim (). Replace (",",);
Save to the database with the above code, the value of colors is: $6 colors, 2 colors, 1 $.
ask for advice on how to remove $before and after id
Thank you