13.07.2015 Views

Microsoft SharePoint. Building Office 2007 Solutions in VB 2005 ...

Microsoft SharePoint. Building Office 2007 Solutions in VB 2005 ...

Microsoft SharePoint. Building Office 2007 Solutions in VB 2005 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

392CHAPTER 10 ■ SHAREPOINT WEB PARTSProtected Overloads Overrides Sub RenderContents( _ByVal writer As HtmlTextWriter)Trywriter.Write(objProviderPart.ProvidedStr<strong>in</strong>g)Catchwriter.Write("No Connection")End TryEnd SubEnd ClassOnce you have created and deployed compatible web parts, you can add them to a page.After they are on the page, they can be connected us<strong>in</strong>g the web part menu associated witheither the provider or the consumer. When compatible web parts are on the same page, a menuitem titled Connections will be available for select<strong>in</strong>g a compatible web part. This menu itemfunctions identically to the ones you have used previously <strong>in</strong> the book to connect out-of-theboxweb parts.Us<strong>in</strong>g Standard Connection InterfacesWhile creat<strong>in</strong>g custom <strong>in</strong>terfaces is a quick way to connect web parts, they cannot be used toconnect to libraries, lists, and out-of-the box web parts. <strong>SharePo<strong>in</strong>t</strong> provides a separate set of<strong>in</strong>terfaces that constitute a standard mechanism for connect<strong>in</strong>g web parts. These <strong>in</strong>terfacesexpose methods and events that allow the connection <strong>in</strong>frastructure to query your web partsfor appropriate connection <strong>in</strong>formation and provide notification when another web partwants to connect. The available <strong>in</strong>terfaces support pass<strong>in</strong>g a s<strong>in</strong>gle piece of data, a row ofdata, or an entire list of data. Table 10-1 lists the available <strong>in</strong>terfaces and their purposes.Table 10-1. Connection InterfacesInterfaceIWebPartFieldIWebPartRowIWebPartTableIWebPartParametersPurposeAllows a web part to provide or consume a cell of dataAllows a web part to provide or consume a row of dataAllows a web part to provide or consume a recordset of dataAllows a web part to provide or consume multiple cells of data that can bemapped to the data cells <strong>in</strong> another web partIf a provider web part and a consumer web part are exchang<strong>in</strong>g similar data—such as as<strong>in</strong>gle cell—they may be connected directly us<strong>in</strong>g the web part menu associated with eitherpart. Connection <strong>in</strong>terfaces, however, can often allow connections that are not immediatelyobvious. For example, a web part that provides an entire row can be connected to a web partthat only consumes a s<strong>in</strong>gle field.Determ<strong>in</strong><strong>in</strong>g which <strong>in</strong>terfaces are compatible is handled by the web part <strong>in</strong>frastructureaccord<strong>in</strong>g to several rules. The first, and most obvious, rule is that web parts provid<strong>in</strong>g or consum<strong>in</strong>gthe same data structures are always compatible. For <strong>in</strong>terfaces that use different datastructures, extended connections—known as transformers—are allowed where they make

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!