In certain situation we need to pass data from webpart to another webpart present in the same site. To implement the connection functionality between WebParts, we should create an Interface .This interface will be implemented by both the provider and consumer classes.
Then we will use the ConnectionProvider and ConnectionConsumer attribute to make the connection between the two webpart.
EXAMPLE:
1. Interface :
public interface Test
{
string Name { get; set; }
}
2. The provider class :
public class Provider : WebPart, Test
{
TextBox tb = new TextBox();
Button btn = new Button();
string _Name = "";
public string Name
{
get{return _Name;}
set{_Name = value;}
}
Thanks,
Eliza
SharePoint Customization