Sompal Arya

Sompal Arya

  • NA
  • 286
  • 50.5k

fliter searching in dataset with highlighting searching item

Feb 11 2014 2:45 AM
in this code this line is not working

   return ("<span class=highlight>" + m.Value + "</span>");

suppose m="Delhi"

output screen it is print as "<span class=highlight>Delhi</span>


  public string HighlightText(string InputTxt)
  {
  string Search_Str = FilterSearchTerms.Text;
  // Setup the regular expression and add the Or operator.
  Regex RegExp = new Regex(Search_Str.Replace(" ", "|").Trim(), RegexOptions.IgnoreCase);
  // Highlight keywords by calling the
  //delegate each time a keyword is found.
  return RegExp.Replace(InputTxt, new MatchEvaluator(ReplaceKeyWords));
  }

  public string ReplaceKeyWords(Match m)
  {

  //  return ( m.Value);
  return ("<span class=highlight>" + m.Value + "</span>");
  }

Attachment: revenue.rar