SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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

Is there a way to retrieve the selected list item title/name? For example if I click an item say "Distributor" in custom list, how can I get this title in a string or variable?

enter image description here

share|improve this question
What are you trying to do? – Eric Alexander Aug 6 '12 at 12:26

If you mean doing it through code you could use the getSelectedItems() method:

var items = SP.ListOperation.Selection.getSelectedItems(context);

You could then just iterate through the items and get the desired attribute:

for(i in items) 
 // do something

Here is an example of it in use

share|improve this answer
This is the only approach. There is no equivalent to this method on the server side as the selection is completely done client side in SharePoint. – Vardhaman Deshpande Aug 6 '12 at 15:12

You can use CAML and SPQuery:

private SPListCollection GetDecriptionItems(SPList list)
  SPQuery query = new SPQuery()
    Query = "<Where><Eq><FieldRef Name='Title' /><Value Type='Distributor'></Value></Eq></Where><OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy>"
  return list.GetItems(query);
share|improve this answer

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.