I am creating a select list as follows:
<formselect id="CountryDropdown" class="form-select form-control form-control-sm"
asp-for="Country"
asp-items="@(new SelectList(@ViewBag.Countries,"TextColumn","TextColumn"))"></formselect>
@ViewBag.Countries contains the item
COTE D'IVOIRE
The formselect tag helper converts this to:
<option value="COTE D'IVOIRE">COTE D'IVOIRE</option>
How do I get the entry in the select list to be
<option value="COTE D'IVOIRE">COTE D'IVOIRE</option>
I solved this by editing the code that loaded ViewBag.Countries. The below code is used to eliminate D'
foreach (LookupListItem l in items)
l.TextColumn = l.TextColumn.Replace("'", "'");