using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text.RegularExpressions; public partial class Add_Details : System.Web.UI.Page { private string Searchstring = ""; protected void Page_Load(object sender, EventArgs e) { } public string HighlightText(string InputTxt) { string Search_Str = txtSearch.Text; Regex RegExp =new Regex(Search_Str.Replace("","|").Trim(), RegexOptions.IgnoreCase); return RegExp.Replace(InputTxt, new MatchEvaluator(Replacekeywords)); } public string Replacekeywords(Match m) { return ("<span class=highlight>" + m.Value + "</span>"); } protected void btnSearch_Click(object sender, EventArgs e) { Searchstring = txtSearch.Text; } protected void clear_Click(object sender, EventArgs e) { txtSearch.Text = ""; Searchstring = ""; gvDetails.DataBind(); } }
Regex RegExp =new Regex(Search_Str.Replace(" ","|").Trim(), RegexOptions.IgnoreCase);
Regex RegExp =new Regex(Search_Str.Replace("","|").Trim(), RegexOptions.IgnoreCase);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)