There are a million articles about using seven different interfaces and fourteen .wsp deployments to make an entirely custom connection provider and consumer. However, I couldn’t find one about how to create a simple connection consumer that filters based on a SharePoint list. I also couldn’t find anything about changing the brand-new double-headed arrow icon that SharePoint replaced the radio button with. Turns out they can go in the same simple solution:
- Setting up the Consumer – This consumer will take a single row of information from a SharePoint list. It’s implemented in “MyWebPart.cs” and not in a user control.
This code sets up the DataRow. Note that the “provider” parameter is passed by the SharePoint connection.
- Capturing your data – This is where you can actually use the filter – manipulate, save, and query to your heart’s content. Below is a sample RecieveRow method:
That’s all there is to it. You can fill a data structure in the RecieveRow method and pass it on to a user control the same way you would pass any other value.
- Customization – Here’s a little bonus – how to update the radio buttons with the filter wsp.
- In the hive, the double-headed arrow radio buttons are the following two files:
- If you want to replace them create a folder in your solution package with the following path: MyWebPartProject > TEMPLATE > IMAGES
- Rename your “on” radio button “RBSEL” and save it as a gif
- Rename your “off” radio button “RBUNSEL” and save it as a gif
- Place both of them in the IMAGES folder.
- When you deploy, it will overwrite the default arrows.
This change OVERWRITES the default SharePoint images. Only do this if you want to update all of the radio buttons on the farm. Otherwise you will have to restore the double-headed arrow icons, and it won’t be fun.
[Image via the San Francisco Weekly]