SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I am trying to create an a to z directory from a list of items which should be an easy task and it is really, however, I am trying to find the most efficient way of doing it.

So I was thinking use querystring as a filter value and then loop through, outputting the items where the first letter matches the letter that is specified in the querystring.

This works, yay! But i know it is inefficient, I shoup be querying the list for all items that have the first letter and then displaying them.

Anyone know a good way to do this, even pseudo code is fine, i am not expecting anyone to do this for me just pointing in the right direction would be good.

For clarification, I want to create this in code, no code solutions are no good here as there is other stuff going on too.


share|improve this question

I am going to cover a few things as I don't know exactly what you're doing here.

1) Create a calculated column to display the first letter of your field using formula - lets call this "FirstLetter"


2) Optionally, you can then use the Group By feature to show a collapsed/expanded list on [FirstLetter] - (see "The By Last Name View" here for an example)

3) You can then filter on your First Letter using the normal List View filtering operation.

4) Additionally you could add a filter provider web part (built in if using MOSS/2010 Server) or lots of 3rd part web parts about.

5) Or you can make use of filtering via the query sting - e.g. you put on end of url


and this will apply the X filter.

So you can build up a a 'chooser' by adding something like the following HTML to a Content Editor Web Part (CEWP) or source in wiki.

<a href="/yoursite/yourpage.aspx?FilterField1=FirstLetter&FilterValue1=A">A</A> |
<a href="/yoursite/yourpage.aspx?FilterField1=FirstLetter&FilterValue1=B">B</A> |
<a href="/yoursite/yourpage.aspx?FilterField1=FirstLetter&FilterValue1=B">C</A> |

and so on

share|improve this answer

share|improve this answer

You may also look into the following article

share|improve this answer
While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference, especially when it is a link to your own blog. See answer for general guidelines. – SPDoctor Mar 4 '13 at 21:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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