/
IWebPartRow.xml
139 lines (111 loc) · 14.2 KB
/
IWebPartRow.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<Type Name="IWebPartRow" FullName="System.Web.UI.WebControls.WebParts.IWebPartRow">
<TypeSignature Language="C#" Value="public interface IWebPartRow" />
<TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract IWebPartRow" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.WebParts.IWebPartRow" />
<TypeSignature Language="VB.NET" Value="Public Interface IWebPartRow" />
<TypeSignature Language="F#" Value="type IWebPartRow = interface" />
<TypeSignature Language="C++ CLI" Value="public interface class IWebPartRow" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Interfaces />
<Docs>
<summary>Defines a provider interface for connecting two server controls using a single field of data.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This interface is designed to be used with Web Parts connections. In a Web Parts connection, two server controls that reside in a <xref:System.Web.UI.WebControls.WebParts.WebPartZoneBase> zone establish a connection and share data, with one control acting as the consumer and the other control acting as a provider. The mechanism for sharing data in a Web Parts connection is an interface instance, which the provider serves to the consumer by means of a callback method. To establish a connection, the consumer and provider must both work with the same interface type for sharing data. If the consumer does not recognize the interface type sent by the provider, it is still possible to connect the controls by means of a transformer (a <xref:System.Web.UI.WebControls.WebParts.WebPartTransformer> object) that translates the interface instance sent by the provider into a type that the consumer recognizes. For details on connections, see <xref:System.Web.UI.WebControls.WebParts.WebPartConnection> and [Web Parts Connections Overview](https://docs.microsoft.com/previous-versions/aspnet/ms178187(v=vs.100)).
The <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface is a provider interface included with the Web Parts control set as a standard interface for creating connections based on a data row. You can also create custom interfaces to use with Web Parts connections, but in many data-driven Web applications, it is useful to create connections based on a common field (for details, see the <xref:System.Web.UI.WebControls.WebParts.IWebPartField> interface), table (for details, see the <xref:System.Web.UI.WebControls.WebParts.IWebPartTable> interface), or row from the data source. In a typical connection, a <xref:System.Web.UI.WebControls.WebParts.WebPart> control acting as a provider would implement the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface and provide an instance of the interface to consumers in a special callback method. For example, the provider might implement an <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface for a row that corresponds to a user in your user information table. Another <xref:System.Web.UI.WebControls.WebParts.WebPart> control acting as a consumer would define a special method to receive the interface instance, and could then extract the user data, use it to look up additional information about that user's accounts, and display all the information related to that user on the page.
The <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface has two exposed members. The <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema%2A> property returns schema information about the data row encapsulated in a <xref:System.ComponentModel.PropertyDescriptorCollection> object. The <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.GetRowData%2A> method declares a method that an implementer (such as a provider control) uses to retrieve the interface instance's row data when the callback method is invoked.
## Examples
The following code example demonstrates how to create a static connection between two controls using the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface. The code example has three parts:
- Source code for two custom <xref:System.Web.UI.WebControls.WebParts.WebPart> controls that can form a connection using the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface, with one control acting as the provider, and the other acting as the consumer.
- A Web page that hosts the controls and declares the static connection in persistence format.
- A description of what happens when the example code runs.
The first part of the code example is the source code for the two custom controls. First is the code for the provider, which implements the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface. For simplicity in the example, the provider creates a table with some data rather than connecting to a database. The `GetConnectionInterface` method serves as the provider's connection point, the callback method that returns the interface instance to the consumer. As for the consumer, it retrieves the interface instance from the provider in its method named `SetConnectionInterface`, which is marked with a `ConnectionConsumer` attribute. After retrieving the instance of the interface, the consumer, in its `OnPreRender` method, calls the implementation of the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.GetRowData%2A> method in the provider, to retrieve the actual data and write it to the page.
For the code example to run, you must compile this source code. You can compile it explicitly and put the resulting assembly in your Web site's Bin folder or the global assembly cache. Alternatively, you can put the source code in your site's App_Code folder, where it will be dynamically compiled at run time. This code example uses dynamic compilation. For a walkthrough that demonstrates how to compile, see [Walkthrough: Developing and Using a Custom Web Server Control](https://msdn.microsoft.com/library/6d90782a-a1a4-45a6-b2d4-cf6362b83b08).
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/CS/IRowSamples.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/VB/IRowSamples.vb" id="Snippet2":::
The second part of the code example is the Web page that declares the static connection and hosts the controls. Near the top of the page is a `Register` directive that declares the namespace of the source code contained in the App_Code directory. The connection is declared using an `<asp:webpartconnection>` element. The custom consumer and provider controls are declared in a `<zonetemplate>` element within an `<asp:webpartzone>` element, which is required for them to be able to connect (they must reside within a zone that inherits from the <xref:System.Web.UI.WebControls.WebParts.WebPartZoneBase> class).
:::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/CS/defaultcs.aspx" id="Snippet1":::
:::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/VB/defaultvb.aspx" id="Snippet1":::
Load the page in a browser. The consumer control displays the data provided from the specified row, which the provider makes available through an instance of the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface.
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.WebParts.WebPartConnection" />
<altmember cref="T:System.Web.UI.WebControls.WebParts.IWebPartField" />
<altmember cref="T:System.Web.UI.WebControls.WebParts.IWebPartTable" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/ms178187(v=vs.100)">Web Parts Connections Overview</related>
</Docs>
<Members>
<Member MemberName="GetRowData">
<MemberSignature Language="C#" Value="public void GetRowData (System.Web.UI.WebControls.WebParts.RowCallback callback);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void GetRowData(class System.Web.UI.WebControls.WebParts.RowCallback callback) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.WebParts.IWebPartRow.GetRowData(System.Web.UI.WebControls.WebParts.RowCallback)" />
<MemberSignature Language="VB.NET" Value="Public Sub GetRowData (callback As RowCallback)" />
<MemberSignature Language="F#" Value="abstract member GetRowData : System.Web.UI.WebControls.WebParts.RowCallback -> unit" Usage="iWebPartRow.GetRowData callback" />
<MemberSignature Language="C++ CLI" Value="public:
 void GetRowData(System::Web::UI::WebControls::WebParts::RowCallback ^ callback);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="callback" Type="System.Web.UI.WebControls.WebParts.RowCallback" />
</Parameters>
<Docs>
<param name="callback">A <see cref="T:System.Web.UI.WebControls.WebParts.RowCallback" /> delegate that contains the address of a method that receives the data.</param>
<summary>Returns the data for the row that is being used by the interface as the basis of a connection between two <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> controls.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method to retrieve the data row values passed by the interface. The provider implements this method, and the consumer invokes it at the point when the consumer is ready to process or render data.
## Examples
The following code example shows the implementation and use of the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.GetRowData%2A> method. The complete example is shown in the class overview for the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface. The provider control implements the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.GetRowData%2A> method, returning the value of a particular row in the data table. The consumer control calls the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.GetRowData%2A> method in its `OnPreRender` method, so that the value of the data can be written to the page.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/CS/IRowSamples.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/VB/IRowSamples.vb" id="Snippet2":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Schema">
<MemberSignature Language="C#" Value="public System.ComponentModel.PropertyDescriptorCollection Schema { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.ComponentModel.PropertyDescriptorCollection Schema" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Schema As PropertyDescriptorCollection" />
<MemberSignature Language="F#" Value="member this.Schema : System.ComponentModel.PropertyDescriptorCollection" Usage="System.Web.UI.WebControls.WebParts.IWebPartRow.Schema" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::ComponentModel::PropertyDescriptorCollection ^ Schema { System::ComponentModel::PropertyDescriptorCollection ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.ComponentModel.PropertyDescriptorCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the schema information for a data row that is used to share data between two <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> controls.</summary>
<value>A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> describing the data.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property provides property information for the data. Using the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface in a connection, you get a <xref:System.ComponentModel.PropertyDescriptorCollection> object, which is referenced by the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema%2A> property. The contract specifies that calling `Schema[n].GetValue(RowData)` returns the value of the *n*th column in the row. You need to use the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema%2A> property to get the values in the row.
## Examples
The following code example shows the implementation and use of the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema%2A> property. The complete example is shown in the class overview for the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow> interface. The provider control implements the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema%2A> property. Then the consumer control, in its `RenderContents` method, queries the <xref:System.Web.UI.WebControls.WebParts.IWebPartRow.Schema%2A> property to retrieve information about the row as it writes the row data to the page.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/CS/IRowSamples.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebPartRow_Overview/VB/IRowSamples.vb" id="Snippet2":::
]]></format>
</remarks>
<altmember cref="T:System.ComponentModel.PropertyDescriptorCollection" />
</Docs>
</Member>
</Members>
</Type>