How can I find all items beginning with a or â?
Posted
by Malcolm Frexner
on Stack Overflow
See other posts from Stack Overflow
or by Malcolm Frexner
Published on 2010-06-01T17:14:12Z
Indexed on
2010/06/01
17:23 UTC
Read the original article
Hit count: 219
I have a list of items that are grouped by their first letter. By clicking a letter the user gets alle entries that begin with that letter.
This does not work for french. If I choose the letter a, items with â are not returned.
What is a good way to return items no matter if they have an accent or not?
<% char alphaStart = Char.Parse("A");
char alphaEnd = Char.Parse("Z"); %>
<% for (char i = alphaStart; i <= alphaEnd; i++) { %>
<% char c = i; %>
<% var abcList = Model.FaqList.Where(x => x.CmsHeader.StartsWith(c.ToString())).ToList(); %>
<% if (abcList.Count > 0 ) { %>
<div class="naviPkt">
<a id="<%= i.ToString().ToUpper() %>" class="naviPktLetter" href="#<%= i.ToString().ToLower() %>"><%= i.ToString().ToUpper() %></a>
</div>
<ul id="menuGroup<%= i.ToString().ToUpper() %>" class="contextMenu" style="display:none;">
<% foreach (var info in abcList) { %>
<li class="<%= info.CmsHeader%>">
<a id="infoId<%= info.CmsInfoId%>" href="#<%= info.CmsInfoId%>" class="abcEntry"><%= info.CmsHeader%></a>
</li>
<% } %>
</ul>
<% } %>
<% } %>
© Stack Overflow or respective owner