Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighting text in Gridview

Status
Not open for further replies.

robertfah

Programmer
Mar 20, 2006
380
US
I've got an FAQ section that displays FAQs in a gridview. There is also a textbox that a user can enter a keyword into and it should search the description field of the gridview and highlight the word if it's found. This code works only if I switch between pages:

if (e.Row.Cells.Count == 4)
{
if (txtKeyword.Text != string.Empty)
e.Row.Cells[3].Text = Pages.Instance.HighlightText(e.Row.Cells[3].Text, txtKeyword.Text);
}

The Pages.Instance.HighlightText simply does a Replace and inserts a <span> tag and assigns it to a class that highlights it.

So the above works ONLY when the user pages between faqs. If the user enters a keyword and hits the "Find" button, the page reloads, but the RowDataBound method does not fire.

So my question is, is there a method in the Gridview that fires upon postback of the page? I tried to do a DataBind upon the find button being fired, but the RowDataBound method still isn't called.

Any help would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top