Solved

ASP.NET 2005, IE 6 - Highlight Searched Keywords Within A Text Block Displayed In A Grid

Posted on 2007-12-04
2
400 Views
Last Modified: 2013-11-26
Experts,
How do i highlight matching words displayed in a grid if i have a keyword in a variable?
0
Comment
Question by:feesu
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
DreamMaster earned 125 total points
ID: 20410052
The easiest way to do this is to write out the page that was found, and then do a replace on the keywords that were searched for.

So lets say your keyword is in a variable called "searchword"

You are writing out a result as the text for a page, lets say the variable for that is called pagetext

Now you write out the pagetext and do this:

pagetext.Replace(searchword, "<span class=""highlighted"">" & searchword & "</span>")

Now all you need to do is create a stylesheet for that span class="highlighted"

Hope this makes sense.
Regards,
Max.
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 20463198
Glad to have been helpful :)

Regards,
Max.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question