I need make a comma seperated list, but whwn I build the list I get a
comma at the end. How do I remove it?
Hello,
Instead of a 'for-each' loop, you can use a regular 'for' loop and check
whether the iterator's value is less than the last item's index
(REIPropertyType.Items.Count???? - 1) and if so, append the comma:
for (int i = 0; i < REIPropertyType.Items.Count; i++)
{
ListItem lst = REIPropertyType.Items[i] as ListItem;
if (lst.Selected == true)
REIPropertyTypeVal += lst.ToString();
if (i < REIPropertyType.Items.Count - 1)
REIPropertyTypeVal += ",";
}
Hope this helps.
--
Best regards,
Stanimir Stoyanov
ad***@nospam.stoyanoff.info