/
WebPartDescription.xml
360 lines (301 loc) · 33.1 KB
/
WebPartDescription.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<Type Name="WebPartDescription" FullName="System.Web.UI.WebControls.WebParts.WebPartDescription">
<TypeSignature Language="C#" Value="public class WebPartDescription" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit WebPartDescription extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.WebParts.WebPartDescription" />
<TypeSignature Language="VB.NET" Value="Public Class WebPartDescription" />
<TypeSignature Language="F#" Value="type WebPartDescription = class" />
<TypeSignature Language="C++ CLI" Value="public ref class WebPartDescription" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides information about a <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control that you can display in a catalog of Web Parts controls without having to create an instance of the control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When <xref:System.Web.UI.WebControls.WebParts.WebPart> controls are displayed in a catalog of controls that users can add to a page, some basic information about each control is required. For example, it is useful to have a title for the control, and a description, so that as users view a catalog they have enough information to decide whether to add a control to the page. However, a catalog of <xref:System.Web.UI.WebControls.WebParts.WebPart> controls can potentially contain many controls, and it could affect the performance of an application if an instance of every <xref:System.Web.UI.WebControls.WebParts.WebPart> control must be created to extract the information to display in the catalog.
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class exists so that it is not necessary to create an instance of a <xref:System.Web.UI.WebControls.WebParts.WebPart> control to retrieve the information about the control that is displayed in a catalog of controls. In the Web Parts control set, a <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> object is also used in conjunction with the various <xref:System.Web.UI.WebControls.WebParts.CatalogPart> controls when a page is in catalog display mode.
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class has two overloads of its constructor, one that takes a <xref:System.Web.UI.WebControls.WebParts.WebPart> control as a parameter when an instance is available (the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor), and one that takes several strings with information about the control as parameters (the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor).
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class also has several properties designed to contain the description information for <xref:System.Web.UI.WebControls.WebParts.WebPart> controls. The following table summarizes the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> properties, and what property each one corresponds to in a <xref:System.Web.UI.WebControls.WebParts.WebPart> control.
|Description property|Related part control property|
|--------------------------|-----------------------------------|
|<xref:System.Web.UI.WebControls.WebParts.WebPartDescription.ID%2A>|<xref:System.Web.UI.Control.ID%2A>|
|<xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Title%2A>|<xref:System.Web.UI.WebControls.WebParts.Part.Title%2A>|
|<xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Description%2A>|<xref:System.Web.UI.WebControls.WebParts.Part.Description%2A>|
|<xref:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl%2A>|<xref:System.Web.UI.WebControls.WebParts.WebPart.CatalogIconImageUrl%2A>|
## Examples
The following code example demonstrates programmatic use of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class. Ordinarily, this type is used primarily by the Web Parts control set, but this code example is simply showing basic programmatic usage of the main description properties.
The code example has four parts:
- A user control that enables users to change display modes on a Web page.
- A custom <xref:System.Web.UI.WebControls.WebParts.WebPart> control.
- A Web page to host the other controls.
- An explanation of how the code example works.
The first part of the code example is the user control. The source code for the user control comes from another topic. For more details about the user control, see the topic [Walkthrough: Changing Display Modes on a Web Parts Page](https://msdn.microsoft.com/library/24e42f74-82dc-4c13-8574-130398985fc0).
[!code-aspx-csharp[WebParts_WebPartDescription_Overview#7](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/DisplayModeMenuCS.ascx#7)]
[!code-aspx-vb[WebParts_WebPartDescription_Overview#7](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/DisplayModeMenuVB.ascx#7)]
The second part of the code example is a custom <xref:System.Web.UI.WebControls.WebParts.WebPart> control. 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 the approach of 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-csharp[WebParts_WebPartDescription_Overview#3](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/textdisplaywebpart.cs#3)]
[!code-vb[WebParts_WebPartDescription_Overview#3](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/textdisplaywebpart.vb#3)]
The third part of the code example is the Web page. Near the top are two `Register` directives: one that registers the user control, and the other to register the custom <xref:System.Web.UI.WebControls.WebParts.WebPart> control whose source file is located in the App_Code folder of your site. The page contains an `<asp:catalogzone>` element, which in turn contains declarative references to two controls: the custom <xref:System.Web.UI.WebControls.WebParts.WebPart> control named `TextDisplayWebPart`, and a <xref:System.Web.UI.WebControls.BulletedList> Web server control that will be treated as a <xref:System.Web.UI.WebControls.WebParts.WebPart> control at run time because the <xref:System.Web.UI.WebControls.WebParts.WebPartManager> control will wrap it with a <xref:System.Web.UI.WebControls.WebParts.GenericWebPart> object. Note that in the code for the `Button1_Click` method, the available <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects for the <xref:System.Web.UI.WebControls.WebParts.WebPart> controls in the catalog are retrieved using the <xref:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions%2A> method, and then the description details are all written out to the page.
[!code-aspx-csharp[WebParts_WebPartDescription_Overview#1](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/wpDescriptioncs.aspx#1)]
[!code-aspx-vb[WebParts_WebPartDescription_Overview#1](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/wpDescriptionvb.aspx#1)]
After you load the page in a browser, use the **Display Mode** drop-down list control and select **Catalog** to change the page to catalog display mode. In the catalog, you should see the two controls that are available to be added to the page. Click the **List WebPartDescription Information** button, and the code writes out the values of all available <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects to the page. This demonstrates that you can retrieve description details for <xref:System.Web.UI.WebControls.WebParts.WebPart> controls in a catalog without having to create instances of the controls themselves.
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions" />
<altmember cref="T:System.Web.UI.WebControls.WebParts.WebPartDescriptionCollection" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the class that contains information about a specific <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The overloads for the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor each return a new instance of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class, which contains information about a specific <xref:System.Web.UI.WebControls.WebParts.WebPart> control. The difference between the overloads is the scenario in which the new instance is created. In some cases, when the application has an available instance of a <xref:System.Web.UI.WebControls.WebParts.WebPart> control, the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor is used. When the application does not have a control instance, as is the case when a control description file is being imported through the <xref:System.Web.UI.WebControls.WebParts.ImportCatalogPart> control, the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor is used.
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public WebPartDescription (System.Web.UI.WebControls.WebParts.WebPart part);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Web.UI.WebControls.WebParts.WebPart part) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.WebParts.WebPartDescription.#ctor(System.Web.UI.WebControls.WebParts.WebPart)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (part As WebPart)" />
<MemberSignature Language="F#" Value="new System.Web.UI.WebControls.WebParts.WebPartDescription : System.Web.UI.WebControls.WebParts.WebPart -> System.Web.UI.WebControls.WebParts.WebPartDescription" Usage="new System.Web.UI.WebControls.WebParts.WebPartDescription part" />
<MemberSignature Language="C++ CLI" Value="public:
 WebPartDescription(System::Web::UI::WebControls::WebParts::WebPart ^ part);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="part" Type="System.Web.UI.WebControls.WebParts.WebPart" />
</Parameters>
<Docs>
<param name="part">A <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control whose information is contained in a <see cref="T:System.Web.UI.WebControls.WebParts.WebPartDescription" />.</param>
<summary>Initializes a new instance of the class when a <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control instance is available.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor is used for creating a new <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> object based on an existing <xref:System.Web.UI.WebControls.WebParts.WebPart> control. This constructor simply calls the other overload, the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%28System.String%2CSystem.String%2CSystem.String%2CSystem.String%29> constructor, obtaining the required parameter values from properties on the `part` parameter.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="P:System.Web.UI.Control.ID" /> property of <paramref name="part" /> is <see langword="null" /> or an empty string ("").</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public WebPartDescription (string id, string title, string description, string imageUrl);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string id, string title, string description, string imageUrl) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.WebParts.WebPartDescription.#ctor(System.String,System.String,System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (id As String, title As String, description As String, imageUrl As String)" />
<MemberSignature Language="F#" Value="new System.Web.UI.WebControls.WebParts.WebPartDescription : string * string * string * string -> System.Web.UI.WebControls.WebParts.WebPartDescription" Usage="new System.Web.UI.WebControls.WebParts.WebPartDescription (id, title, description, imageUrl)" />
<MemberSignature Language="C++ CLI" Value="public:
 WebPartDescription(System::String ^ id, System::String ^ title, System::String ^ description, System::String ^ imageUrl);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="title" Type="System.String" />
<Parameter Name="description" Type="System.String" />
<Parameter Name="imageUrl" Type="System.String" />
</Parameters>
<Docs>
<param name="id">The value to assign to the <see cref="P:System.Web.UI.WebControls.WebParts.WebPartDescription.ID" />.</param>
<param name="title">The value to assign to the <see cref="P:System.Web.UI.WebControls.WebParts.WebPartDescription.Title" />.</param>
<param name="description">The value to assign to the <see cref="P:System.Web.UI.WebControls.WebParts.WebPartDescription.Description" />.</param>
<param name="imageUrl">The value to assign to the <see cref="P:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl" />.</param>
<summary>Initializes a new instance of the class by using several strings that contain description information for a <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.%23ctor%2A> constructor is used to create a new instance of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class when a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is not available. For example, this occurs in the case of an <xref:System.Web.UI.WebControls.WebParts.ImportCatalogPart> control when it imports a description file for a <xref:System.Web.UI.WebControls.WebParts.WebPart> control. It gets the information it needs to create a <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> object directly from the description file, and a <xref:System.Web.UI.WebControls.WebParts.WebPart> instance is not present.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="id" /> or <paramref name="title" /> is <see langword="null" /> or an empty string ("").</exception>
</Docs>
</Member>
<Member MemberName="CatalogIconImageUrl">
<MemberSignature Language="C#" Value="public string CatalogIconImageUrl { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string CatalogIconImageUrl" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property CatalogIconImageUrl As String" />
<MemberSignature Language="F#" Value="member this.CatalogIconImageUrl : string" Usage="System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ CatalogIconImageUrl { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a URL containing the path to an image used as an icon for a <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control.</summary>
<value>A string that contains a URL; the default value is an empty string ("").</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl%2A> property corresponds directly to the <xref:System.Web.UI.WebControls.WebParts.WebPart.CatalogIconImageUrl%2A?displayProperty=nameWithType> property. If that property is set on a <xref:System.Web.UI.WebControls.WebParts.WebPart> control, then the property in the corresponding <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> object will also have a value.
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl%2A> property applies only when a page is in catalog display mode, and a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is being displayed in a catalog of controls. If the control has an icon assigned to it in the property value, the icon appears in the catalog next to the control.
## Examples
The following code example demonstrates programmatic use of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl%2A> property. For the full code required to run this code example, see the Example section of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class overview topic.
The following code in the `Button1_Click` method of a Web page demonstrates how to get the collection of <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects in a catalog using the <xref:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions%2A> method, and then to display the details of each <xref:System.Web.UI.WebControls.WebParts.WebPart> control in the catalog by looping through the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects. Note that the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.CatalogIconImageUrl%2A> property value is retrieved in the following code.
[!code-csharp[WebParts_WebPartDescription_Overview#2](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/wpDescriptioncs.aspx#2)]
[!code-vb[WebParts_WebPartDescription_Overview#2](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/wpDescriptionvb.aspx#2)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.WebParts.WebPart.CatalogIconImageUrl" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
</Docs>
</Member>
<Member MemberName="Description">
<MemberSignature Language="C#" Value="public string Description { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Description" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.WebParts.WebPartDescription.Description" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Description As String" />
<MemberSignature Language="F#" Value="member this.Description : string" Usage="System.Web.UI.WebControls.WebParts.WebPartDescription.Description" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Description { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the text of a description for a <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control.</summary>
<value>A string that contains the description for a <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control; the default value is an empty string ("").</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Description%2A> property corresponds directly to the <xref:System.Web.UI.WebControls.WebParts.Part.Description%2A?displayProperty=nameWithType> property. If that property is set on a <xref:System.Web.UI.WebControls.WebParts.WebPart> control, then the property in the corresponding <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> object will also have a value.
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Description%2A> property applies only when a page is in catalog display mode, and a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is being displayed in a catalog of controls. If the control has a description assigned to it, the description appears in the catalog as a ToolTip on the control.
## Examples
The following code example demonstrates programmatic use of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Description%2A> property. For the full code required to run this code example, see the Example section of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class overview topic.
The following code in the `Button1_Click` method of a Web page demonstrates how to get the collection of <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects in a catalog using the <xref:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions%2A> method, and then to display the details of each <xref:System.Web.UI.WebControls.WebParts.WebPart> control in the catalog by looping through the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects. Note that the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Description%2A> property value is retrieved in the following code.
[!code-csharp[WebParts_WebPartDescription_Overview#2](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/wpDescriptioncs.aspx#2)]
[!code-vb[WebParts_WebPartDescription_Overview#2](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/wpDescriptionvb.aspx#2)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.WebParts.Part.Description" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
</Docs>
</Member>
<Member MemberName="ID">
<MemberSignature Language="C#" Value="public string ID { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string ID" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.WebParts.WebPartDescription.ID" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property ID As String" />
<MemberSignature Language="F#" Value="member this.ID : string" Usage="System.Web.UI.WebControls.WebParts.WebPartDescription.ID" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ ID { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the ID of a corresponding <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control.</summary>
<value>A string that contains the ID of the control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The value of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.ID%2A> property cannot be `null`; it must always have a value. The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.ID%2A> property corresponds directly to the <xref:System.Web.UI.Control.ID%2A?displayProperty=nameWithType> property.
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.ID%2A> property applies only when a page is in catalog display mode, and a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is being displayed in a catalog of controls.
## Examples
The following code example demonstrates programmatic use of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.ID%2A> property. For the full code required to run this code example, see the Example section of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class overview topic.
The following code in the `Button1_Click` method of a Web page demonstrates how to get the collection of <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects in a catalog using the <xref:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions%2A> method, and then to display the details of each <xref:System.Web.UI.WebControls.WebParts.WebPart> control in the catalog by looping through the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects. Note that the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.ID%2A> property value is retrieved in the following code.
[!code-csharp[WebParts_WebPartDescription_Overview#2](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/wpDescriptioncs.aspx#2)]
[!code-vb[WebParts_WebPartDescription_Overview#2](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/wpDescriptionvb.aspx#2)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.Control.ID" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
</Docs>
</Member>
<Member MemberName="Title">
<MemberSignature Language="C#" Value="public string Title { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Title" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.WebParts.WebPartDescription.Title" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Title As String" />
<MemberSignature Language="F#" Value="member this.Title : string" Usage="System.Web.UI.WebControls.WebParts.WebPartDescription.Title" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Title { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the title text of a corresponding <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> control.</summary>
<value>A string that contains the title of the corresponding control. The default value is a calculated string supplied by the .NET Framework.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The value of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Title%2A> property corresponds directly to the <xref:System.Web.UI.WebControls.WebParts.WebPart.DisplayTitle%2A?displayProperty=nameWithType> property. Whatever the corresponding <xref:System.Web.UI.WebControls.WebParts.WebPart> control has for its <xref:System.Web.UI.WebControls.WebParts.WebPart.DisplayTitle%2A> property, that becomes the value of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Title%2A> property; otherwise, the title is a calculated value.
The <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Title%2A> property applies only when a page is in catalog display mode, and a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is being displayed in a catalog of controls. Whatever title is assigned to a <xref:System.Web.UI.WebControls.WebParts.WebPart> control appears next to the control in the catalog.
## Examples
The following code example demonstrates programmatic use of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Title%2A> property. For the full code required to run this code example, see the Example section of the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> class overview topic.
The following code in the `Button1_Click` method of a Web page demonstrates how to get the collection of <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects in a catalog using the <xref:System.Web.UI.WebControls.WebParts.CatalogPart.GetAvailableWebPartDescriptions%2A> method, and then to display the details of each <xref:System.Web.UI.WebControls.WebParts.WebPart> control in the catalog by looping through the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription> objects. Note that the <xref:System.Web.UI.WebControls.WebParts.WebPartDescription.Title%2A> property value is retrieved in the following code.
[!code-csharp[WebParts_WebPartDescription_Overview#2](~/snippets/csharp/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/CS/wpDescriptioncs.aspx#2)]
[!code-vb[WebParts_WebPartDescription_Overview#2](~/snippets/visualbasic/VS_Snippets_WebNet/WebParts_WebPartDescription_Overview/VB/wpDescriptionvb.aspx#2)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.WebParts.WebPart.DisplayTitle" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/e0s9t4ck(v=vs.100)">ASP.NET Web Parts Controls</related>
</Docs>
</Member>
</Members>
</Type>