Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bluestar
Posting Yak Master
133 Posts |
Posted - 2008-08-19 : 14:42:43
|
hello I have Gridview Control that populates data (3 colums) from database,User will enter data in 3 textboxes. I would like to highlight data entered by users in 3 textboxes in this GridView .The thing is I am only being able to highlight data entered in textbox1.I am not being able to implement this logic for other 2 textboxes.here is what I did for 1 textbox. the one column which will contain search result,<asp:TemplateField HeaderText="Search Element"> <ItemTemplate><asp:Label id="lblOutput" runat="server" Text='<%#findAndHighlight(Eval("SearchElement"))%>'/></ItemTemplate> </asp:TemplateField>findAndHighlight is a function.public String findAndHighlight(Object obj) { String strInput = (String)obj; String strSearch = TextBox1.Text; System.Text.RegularExpressions.Regex strResult = new System.Text.RegularExpressions.Regex(strSearch.Replace(" ", "|"), System.Text.RegularExpressions.RegexOptions.IgnoreCase); return strResult.Replace(strInput, new System.Text.RegularExpressions.MatchEvaluator(this.replaceWords)); } public String replaceWords(System.Text.RegularExpressions.Match m) { return "<span class=\"highlight\">" + m + "</span>"; }please help me how to use this logic ,so that I will be able to highlight data enetred in other 2 textboxes.Thank you, |
|
|
|
|