ConvincingMail - Email Marketing SoftwareConvincingMail
 
Email Marketing Software

Welcome Guest! To enable all features please try to register or login.
Highlighting of found search terms
pherbio
#1 Posted : Wednesday, February 11, 2009 7:35:19 AM(UTC)
Rank: Newbie

Groups: Member
Joined: 2/11/2009(UTC)
Posts: 1
Points: 3

How do I change the highlighting of searched text?

example:

Search: or
Return: North Dakota

Right now, it only will highlight the term if it if begins with the search text.

Also, how would I highlight multiple search text?

example:

Search: or ta
Return: North Dakota

Edit: I've already got the query changed to return the proper results, so I don't need help with the query, just the modification on the highlighting.
trooper
#2 Posted : Wednesday, February 11, 2009 8:40:12 AM(UTC)
Rank: Administration

Groups: Administration
Joined: 11/18/2007(UTC)
Posts: 92
Points: 188
Man

Was thanked: 2 time(s) in 2 post(s)
Hi,
All you need is to wrap text you want to hilight with <span class="hilighted">text to hilight<span>
here is the common code from SuggestionTools.cs class.

Code:
public static string HighLight(string text, string value)
       {
           Regex regex = new Regex("\\s(" + value + ")|^(" + value + ")",
                                   RegexOptions.Compiled | RegexOptions.IgnoreCase);
           return regex.Replace(text, new MatchEvaluator(MatchEval));
       }

private static string MatchEval(Match match) {
     return "<span class=\"hilighted\">" + match + "</span>";
}


Hope this helps
Thanks.
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFVision Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.5 RC1 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.063 seconds.