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.
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.