I have three connected ListView web parts on an application page, and I want to be able to access the item that is selected in each web part. This is not selected as in the "checkboxes" but rather, the connected item that is passing the filter value to the next web part. I've tried

myWebPart.Connections // empty
myWebPart.FilterValue // null
myWebPart.ConnectionID // null

and virtually every other property of my web part. Is there no way to get the ID of the item being connected?

  • 1
    @MuhammadRaja Yes, but is it relevant? The second one filters from the selected item in the first, and the third filters from the selected item in the second.
    – xdumaine
    Oct 28 '13 at 20:31
  • Can we see more code? In what way are you trying to fetch the data?
    – Mike
    Nov 3 '13 at 16:42
  • @Mike That's what I'm looking for. There's no relevant code to post because not one single thing has remotely worked. I gave some examples of what I've tried, but I can't find anything that helps. I've tried accessing the item from code behind and also through the javascript CSOM, trying every property I could find or think of, including ctx.CurrentItem, but nothing has given me a handle to the connected item in the web part.
    – xdumaine
    Nov 4 '13 at 13:25

I created three web parts connected together and filterable using Title: SharePoint online webpart connections

Choose a color -> Choose a fruit -> View fruit details.

I created the following selector (jQuery required):


Which returns an array of the selected elements which have an ID attribute. You could then do a simple each and do the work you want with each ID.

// will give you:
// 3 (Blue)
// 2 (Blueberry)

Shows up like this in Chrome console:

SharePoint selector to find currently filtered items

I think this will work as long as the you use the Title (linked to item) column in the web parts.

  • I saw this approach somewhere else, and I may have even tried it. It definitely is hacky. Getting the selected item from a a data set by using a jQuery selector to imply the item based on the image in the layout does not seem like the right way to do it, but it's the closest to a working solution, so I'll probably award you the bounty.
    – xdumaine
    Nov 6 '13 at 4:05
  • I agree, it is definitely a hack. I noticed a couple of ctx variables on the page which had some interesting properties: ctx52.overrideFilterQstring = "FilterField1=Color&FilterValue1=Green&" but no ID. :(
    – Kit Menke
    Nov 6 '13 at 14:09

If you use JSLink instead, I think you can connect to the items in the ListView Web Part like this:

  1. In a location of your choice (such as SiteAssets library of your site, or in _catalogs/masterpage), create new JavaScript file.
  2. In the file, add the code below
  3. In your web part, reference this JavaScript file in the JSLink setting, like ~/site/SiteAssets/news_ui.js
(function () {
 // Initialize the variables for overrides objects
 var overrideCtx = {};
 overrideCtx.Templates = {};

 overrideCtx.Templates.Fields = {
 'ID': { 'ItemID' : ctx.CurrentItem.ID } 



  • Can you explain how I would then get the item selected (say, in document.ready)? I'm not really sure what this does. I've tried accessing ctx.CurrentItem, but it's always null. How does this code help me solve my problem?
    – xdumaine
    Nov 4 '13 at 13:24
  • @xdumaine Have you tried iterate through the properties of ctx.CurrentItem properties? for(prop in ctx.CurrentItem) { alert(prop + “ “ + ctx.CurrentItem[prop]) }
    – Benny Skogberg
    Nov 5 '13 at 16:26
  • Well I would, except ctx.CurrentItem is null, like I said. It doesn't have any value, or any properties.
    – xdumaine
    Nov 5 '13 at 16:30
  • Have you tried debugging with cksdev?
    – Benny Skogberg
    Nov 5 '13 at 19:30
  • No, could you explain how I would use that to help? My whole problem is that I don't know what property I'm looking for, not that I can't debug.
    – xdumaine
    Nov 6 '13 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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