I'm working on SharePoint 2010 (with Visual Studio 2010) for an internship and I would like to do a real time search in a SPList from the value in a textbox.

I have something in mind like Google's Instant Search: when someone is doing a search some results (from a certain column in a certain SPList), corresponding to the few letters already written in the textbox, are displayed just below this textbox. The user shouldn't have to refresh the page to see the results. Is there some event that can be directly triggered when a letter is added or removed in the textbox? I already tried with OnTextChanged but it's not in real time.

3 Answers 3


Since I have no reputation of 50 I have to ask you as an answer: Do you have a Web based integration? And have you tried to use JavaScript, jQuery or AJAX for a realtime search? Because Google is using them.

You could easily use JavaScript, because the events you need for this are not in properties but in JavaScript. The event is called "onKeyDown" after that "onKeyUp".

You will have to add a event manually to the Textbox:

YourTextBox.Attributes.Add("OnKeyDown", function);

with asp:

<asp:TextBox ID="TextBox4" onFocus='<%# Search() %>' runat="server"></asp:TextBox>

Still I suggest you use jQuery. JQuery is basically a javascript library which makes writing Javascript alot easier, and the biggest advantage is that it is browser compatable. Since 2010 it is compatible with Visual Studio!

This could also be interesting for you: http://forums.asp.net/t/1483726.aspx?How+to+fire+an+event+when+text+is+typed+into+a+TextBox

However like I said, search for "Real Time Search jQuery" and Google will show you the way. Then just connect your Textbox with an event.

Hope this was what you were looking for.

  • It looks like it is what I would like to do ! I'm going to try this. Thanks ! Commented Feb 19, 2015 at 14:36

If you want the source to get updated as you are typing, you need the UpdateSourceTrigger.

There is a MSDN documentation on this: How to: Control When the TextBox Text Updates the Source

With the UpdateSourceTrigger you can start a database search query and do the search in realtime.


It would have been really great but the code is in XAML and my view's elements are in an aspx file. So I added asp: before each element TextBoxand Binding but there is an error saying that Element 'TextBox.Text' is not a known element. This can occur when there is a compilation error in the Web site, or the web.config file is missing. Same thing with binding. Is there any import or register to add ?

  • It would be also useful if you had a way to display the results below my textbox. Should I use another control ?
    – Williglimes
    Commented Feb 19, 2015 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.