Ask a Question related to ASP.NET General, Design and Development.
-
Stephajn Craig #1
Highlight Text based on certain criteria
The senario is that a user fills out a form specifying some keywords they
want to search a knowledgebase for. For each article that comes back, the
words in the article that match their keywords are highlighted. (Much like
Windows Help does)
At serverside, how would I go about handling this?
--
Stephajn Craig
Stephajn Craig Guest
-
Building Query criteria dynamically based on Form inputs
I need to dynamically build a db query based on form inputs; this such a typical thing I am hoping someone can shortcut me to a more elegant... -
Can't highlight text
I have a file that we can't highlight the text. It is not locked or anything. We can select the text box, but can't edit the text. Three people... -
map based specular highlight?
i've been mucking around with the different shader options and after a bit of playing and testing, it seem you can't set the specular highlight or... -
Automatically highlight text in a text field using a button?
Is there anyway of automatically highlighting (select) all the text in a particular text field, say when pressing a button? If anyone can help? -
Different Subforms based on Query Criteria
I am trying to create a "Workorder" form based on an equipment list and I want the subforms to be different based the "Type" field in the equipment... -
Axel Dahmen #2
Re: Highlight Text based on certain criteria
I can't tell you the exact steps, but within your code-behind file, open a HTTP connection and read the HTML file you want to expose. Then write the content to the client almost 1:1 by using "Response.Write();". Before writing the content you have to examine it and add highlighting tags to it, of course.
HTH,
Axel Dahmne
---------------------------------
"Stephajn Craig" <s.craig@NOSPAMfunsunvacations.com> schrieb im Newsbeitrag news:#kobI1LRDHA.2204@TK2MSFTNGP12.phx.gbl...> The senario is that a user fills out a form specifying some keywords they
> want to search a knowledgebase for. For each article that comes back, the
> words in the article that match their keywords are highlighted. (Much like
> Windows Help does)
>
> At serverside, how would I go about handling this?
>
> --
> Stephajn Craig
>
>Axel Dahmen Guest
-
Axel Dahmen #3
Re: Highlight Text based on certain criteria
If you're using just plain text, it is rather simple:
- Read the whole text into a string variable,
- Search each of the words using string.indexOf() as much as required,
store the indices (+string length) found into a sorted array or anything.
- Go through the array in reverse order and add your tags to the string
at the appropriate places,
- Output the string using Response.Write();
However, it becomes quite complicated if the text contains formatting. In that case I suppose you look for an appropriate control helping you in searching/editing the text portion of the data. There's an IE control providing a HTML-DOM and an XML control (MSXML) providing an XML-DOM.
Axel Dahmen
----------------------
"Stephajn Craig" <s.craig@NOSPAMfunsunvacations.com> schrieb im Newsbeitrag news:eag7vqNRDHA.1580@TK2MSFTNGP11.phx.gbl...> Would I have to do this on a word by word basis? For instance, if I split
> all of the words into a giant array using a space as a delimiter, and then
> loop down through the array finding a match?
>
> And might this work if the content isn't coming from a file, but instead
> from a database?
>
> --
> Stephajn Craig
Axel Dahmen Guest



Reply With Quote

