Creating connected webparts involves the below steps.
Create an Interface
public interface ITextBoxString
Create a property which would be returning a reference to the interface.
public interface ITextBoxString
{
string TextBoxString { get; set; }
}
Provider Webpart
Implement the interface.
public class StringProvider : WebPart, ITextBoxString
create a property which would be returning the interface reference decorate it with ConnectionProvider
[ConnectionProvider("Provider for Text Value", "TextBoxStringProvider")]
public ITextBoxString TextBoxStringProvider()
{
return this;
}
Consumer web part
It should contain the method which would receive the interface.The method should be decorated with ConnectionConsumer attribute.
[ConnectionConsumer("String Consumer", "StringConsumer")]
public void TextBoxStringConsumer(ITextBoxString Provider)
{
_myProvider = Provider;
}
public void TextBoxStringConsumer(ITextBoxString Provider)
{
_myProvider = Provider;
}
YOU ARE ALL SET!
Before we answer this Question, Lets see what are different view scopes present in a list.
View Scope
SPViewScope is a SharePoint enumeration, which has values Default, FilesOnly, Recursive, RecursiveAll.
->Folder 1
Item 1
Item 2
->Item 3
Consider a SHAREPOINT list which has items in the above hierarchy.i.e. 'Folder 1' and 'Item 3' directly at the top level and 'Item 1 ,Item 2' inside the 'Folder 1 '.
Now lets set different scopes and check out what items are seen in the view.
Note : The scope can be set to SPview.Scope or to an SPQuery.Scope
Default