highlighting search results in a gridview problem

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 41
Reputation: julseypart is an unknown quantity at this point 
Solved Threads: 0
julseypart julseypart is offline Offline
Light Poster

highlighting search results in a gridview problem

 
0
  #1
Apr 21st, 2009
hi, i have a gridview search which filters the gridview, displaying the search results, however it wont highlight the results in yellow:

  1. //Highlight relevant search results
  2. public string Highlight()
  3. {
  4. //Declaring a variable to hold search query
  5. string s = txtSearch.Text;
  6.  
  7. if (s != null)
  8. {
  9. //string Search_Str = txtGrid.Text.ToString();
  10.  
  11. // Setup the regular expression
  12. Regex RegExp = new Regex(s.Replace(" ", "|").Trim(), RegexOptions.IgnoreCase);
  13.  
  14. //Highlight keywords by calling the delegate
  15. //each time a keyword is found.
  16. return
  17. RegExp.Replace(s, new MatchEvaluator(ReplaceKeyWords));
  18. // Set the RegExp to null.
  19. //RegExp = null;
  20. }
  21. else
  22. {
  23. return s;
  24. }
  25. }
  26.  
  27.  
  28. // Method which helps find and highlight search results
  29. public string ReplaceKeyWords(Match m)
  30. {
  31.  
  32. return "<span class=highlight>" + m.Value + "</span>";
  33. }

can any1 see a problem?
cheers
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 220
Reputation: mail2saion is an unknown quantity at this point 
Solved Threads: 33
mail2saion's Avatar
mail2saion mail2saion is offline Offline
Posting Whiz in Training

Re: highlighting search results in a gridview problem

 
0
  #2
Apr 21st, 2009
MARK AS SOLVED if its help you.

REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC