Comma in validation list

I have a cell with a validation list applied to it. One of the strings in the list contains a comma and a slash. This is not being correctly included in the list, because of the comma.

Eg: cell.Validation.ValueList.Add("a, b and c") will result in the entry " b and c" being added to the validation list

I tried escaping the comma, but it did not work for me.

Could you please advise whether this is a bug, and if so how to resolve this.

Thanks

Hi Daniel,

you may use following line of code in order to add values to validation list:

cell2.Validation.ValueList.AddRange(new string[] { "a", "b", "c" });

Code snippet:

WebWorksheet sheet = GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex];
WebCell cell = sheet.Cells[0, 1];
cell.PutValue("Select Course:");
WebCell cell2 = sheet.Cells[0, 2];
cell2.CreateValidation(ValidationType.DropDownList, true);
cell2.Validation.ValueList.AddRange(new string[] { "a", "b", "c" });

Thanks,

Thanks for your reply.

However please note that I want to have “a, b and c” as a single entry in the drop down validation list. The problem is that the comma is not being properly displayed. Instead the string is being split, truncted and replaced with a space…

Hi Daniel,

Please use the following line of code:

cell.Validation.ValueList.Add("a\\c b and c");
"\\c" escapes comma in validation.

Thanks,