Search code examples
asp.nettextboxajaxcontroltoolkit

Searchable TextBox?


I'd like to have two textboxes, one that is large and read-only, with content from the server, and another that is one line and that searches the first text box. The word the user puts in TextBox2 would be highlighted/bolded/whatever in TextBox1.

Example:

TextBox1:

This is an example of the possible contents of my read-only text box. It would go on for a bunch of lines...

TextBox2:

box

Is there any way I could do this? I've thought about using the AutoComplete TextBox from the AjaxControlToolkit and setting the Service Path to wherever I'm getting the contents of TextBox1. But that's not doing exactly what I want, because I'd like to interrupt the suggestions and use them to search TextBox1. Any ideas? I'm pretty new to asp.net and just fishing around for somewhere to get started on this one.


Solution

  • I would recommend a JQuery plugin like this. I don't think it will work with a textbox, but you could try. Do you have to use a textbox for the first one? Could you use a DIV instead, if it doesn't work?

    An example of usage:

    $('target').highlight('box');