CSS
2. Code behind : for RowCreated event
protected void gridSample_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.className='OnOver'"); e.Row.Attributes.Add("onmouseout", "this.className='OnOut'"); } }
Two user define function for the high light and set/remove CSS class first function defines how to highlight text by string functions ( not to worry for understand just put it in your code) and second to replaces words.
User Define Function
public string HighlightText(string InputTxt)
{
string Search_Str = txt_catname.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 + "");
}
0 comments:
Post a Comment
COMMENT ON THIS OR GIVE ANY SUGGESTIONS & IDEAS