Found a really helpful method to develop connectable webparts where we can pass objects as reference to another webpart.
http://businessagility.typepad.com/the_edge/2008/11/developing-custom-connectable-web-parts-in-microsoft-office-sharepoint-server-2007.html
The interface which contains the data to pass would look similar to the following:
public interface IDataProviderInterface
{
String myFilterValue { get; set; }
}
The Provider Web Part then implements the data provider interface and provides a method to communicate the data by using the ConnectionProvider method attribute.
[ConnectionProvider("DisplayName", "ID")]
public IDataProviderInterface ProviderMethod()
{
return this as IDataProviderInterface;
}
The Consumer does not directly implement the interface; rather it provides a method to consume the data as specified by the ConnectionConsumer method attribute.
[ConnectionConsumer("DisplayName", "ID")]
public void ConsumerMethod(IDataProviderInterface dataProv)
{
_providedData = dataProv;
}
Monday, December 28, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment