I have a standard search bar on my Sharepoint 2007 home page. I have a list with 700+ entries. Each one has a unique ID (auto created). I want to be able to find a specific ID without having to have a catch-all list view and then scrolling down until i find the correct entry.

I am looking for a syntax in can use in the search box ideally that just returns the item i want.

So the problem boiled down is i want a quick way of finding a specific list item

Any help greatly appreciated

  • is this for a spGridview list?
    – Ali Jafer
    Aug 30, 2012 at 9:44

3 Answers 3


There is a Javascript based solution called - instantlistfilter from codeplex. You can use it to filter any column of a list .

I am not sure whether this would satisfy your need, because this way your primary problem of searching from the search box is not solved. But, if this is something which you have not known, check it out.


You should be using a combination of SPQuery (Linq) with CAML, I can't remember exactly where I read it, but I was going through a book that told me that the best way to get data out of a sharepoint list is to use LINQ with CAML.

You can go through this Linq article of MSDN

and then you can read how to get data you want out of Linq using CAML : Viewing data using CAML

there are few performance issues with Linq as it gets all of the data e.g. in your case it will get all of list items but then

Examples of SPQuery:

using (SPWeb Web = Site.OpenWeb(_RelativeWebUrl))
       SPList List = Web.Lists[_ListName];
       SPQuery query = new SPQuery();                    
       query.Query = String.Format("<Where><Eq><FieldRef Name=\"{0}\" /><Value Type=\"{1}\">{2}</Value></Eq></Where>",_InternalName, _Type,_Value);     
       SPListItemCollection items = currentList.GetItems(query);

You can Use SharePointCamlQueryBuilder to create filters but like I said, its combination of LINQ and CAML :)


If this is for an SPGridView then you can do two techniques!

One is to use the filtering option:


or the second is to make a custom control within the webpart(if it is that) that contains the creation of SPGridview and databinding.

Have a textbox added to the controls first with a button, then add the SPGridview. When the user searches on the textbox and clicks the button it triggers a clickevent for the button that gets the dataview to get the results but this time it has a new feild that contains the textbox.text instead.... and rebind the result to the gridview. So it would look somthing like this:

    void searchButton_Click(object sender, EventArgs e)
        dvUsers = new DataView(DataAccess.GetList(_IDClient, _IDScheme), searchBoxFilter.Text));
        gridView.AutoGenerateColumns = false;
        gridView.DataSource = dvUsers;
        gridView.PagerTemplate = null;

I would suggest using the filter or if you want use the second method if you want it custom made. The second mthod works as i have done it and it returns just the searched query that you want to use.

here are some other ways:


also this:

Querying items in a SharePoint List

http://clintoncherry.wordpress.com/2007/10/15/querying-items-in-a-sharepoint-list/ Hope it helps :)

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.