0
Answer

fliter searching in dataset with highlighting searching item

Sompal Arya

Sompal Arya

11y
1.2k
1
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