hi, i have a gridview search which filters the gridview, displaying the search results, however it wont highlight the results in yellow:
//Highlight relevant search results
public string Highlight()
{
//Declaring a variable to hold search query
string s = txtSearch.Text;
if (s != null)
{
//string Search_Str = txtGrid.Text.ToString();
// Setup the regular expression
Regex RegExp = new Regex(s.Replace(" ", "|").Trim(), RegexOptions.IgnoreCase);
//Highlight keywords by calling the delegate
//each time a keyword is found.
return
RegExp.Replace(s, new MatchEvaluator(ReplaceKeyWords));
// Set the RegExp to null.
//RegExp = null;
}
else
{
return s;
}
}
// Method which helps find and highlight search results
public string ReplaceKeyWords(Match m)
{
return "<span class=highlight>" + m.Value + "</span>";
}
can any1 see a problem?
cheers