|
14 | 14 | <Docs>
|
15 | 15 | <summary>Enables <see cref="T:System.Web.UI.WebControls.WebParts.WebPart" /> controls or other server controls to contain collections of verbs.</summary>
|
16 | 16 | <remarks>
|
17 |
| - <format type="text/markdown"><![CDATA[ |
18 |
| - |
19 |
| -## Remarks |
20 |
| - A verb in <xref:System.Web.UI.WebControls.WebParts.WebPart> controls is an action that a user can carry out in the user interface (UI). Typically, a verb is represented in the UI by a clickable control such as a button, a link, or a menu item. The Web Parts control set provides standard verbs that are available by default to <xref:System.Web.UI.WebControls.WebParts.WebPart> controls and other server controls (such as custom, ASP.NET, and user controls) that can act like <xref:System.Web.UI.WebControls.WebParts.WebPart> controls when placed in <xref:System.Web.UI.WebControls.WebParts.WebPartZoneBase> zones. Standard verbs include close, minimize, restore, delete, edit, and export. |
21 |
| - |
22 |
| - You can also create custom verbs for use with <xref:System.Web.UI.WebControls.WebParts.WebPart> and server controls. The <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface, with its <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> property, gives you a way to integrate custom verbs into your controls. The <xref:System.Web.UI.WebControls.WebParts.WebPart> class implements the <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface and implements its single property. To add custom verbs to a control that inherits from the <xref:System.Web.UI.WebControls.WebParts.WebPart> class, you must override the <xref:System.Web.UI.WebControls.WebParts.WebPart.Verbs%2A?displayProperty=nameWithType> property, add custom verbs to a collection, and return the collection. The collection referenced by the <xref:System.Web.UI.WebControls.WebParts.WebPart.Verbs%2A?displayProperty=nameWithType> property contains only custom verbs; standard verbs are not included in this collection. The default return value of the <xref:System.Web.UI.WebControls.WebParts.WebPart.Verbs%2A?displayProperty=nameWithType> property in a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is `null`, because by default there are no custom verbs in the collection. |
23 |
| - |
24 |
| - Adding custom verbs to server controls that are not <xref:System.Web.UI.WebControls.WebParts.WebPart> controls requires one extra step. In those cases, the controls must also implement the <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface and implement the <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> property. |
25 |
| - |
26 |
| - After you have added custom verbs to the <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> collection, the Web Parts control set automatically handles the other steps necessary to create and render the custom verbs. |
27 |
| - |
28 |
| - |
29 |
| - |
30 |
| -## Examples |
31 |
| - The following code example demonstrates a simple implementation of the <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface. The first part of the code example shows how the interface is implemented in a user control. The user control implements the <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> property by creating two custom verbs and defining a method that is called when a user clicks either of the verbs. For simplicity, the same method is used for both verbs. The method updates the value of a property named `VerbCounterClicks`. The code for the `Page_Load` method accesses the <xref:System.Web.UI.WebControls.WebParts.GenericWebPart.Verbs%2A> property of the control to display the total count of custom verbs in the collection. This count does not include the standard Web Parts verbs. |
32 |
| - |
| 17 | + <format type="text/markdown"><![CDATA[ |
| 18 | +
|
| 19 | +## Remarks |
| 20 | + A verb in <xref:System.Web.UI.WebControls.WebParts.WebPart> controls is an action that a user can carry out in the user interface (UI). Typically, a verb is represented in the UI by a clickable control such as a button, a link, or a menu item. The Web Parts control set provides standard verbs that are available by default to <xref:System.Web.UI.WebControls.WebParts.WebPart> controls and other server controls (such as custom, ASP.NET, and user controls) that can act like <xref:System.Web.UI.WebControls.WebParts.WebPart> controls when placed in <xref:System.Web.UI.WebControls.WebParts.WebPartZoneBase> zones. Standard verbs include close, minimize, restore, delete, edit, and export. |
| 21 | +
|
| 22 | + You can also create custom verbs for use with <xref:System.Web.UI.WebControls.WebParts.WebPart> and server controls. The <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface, with its <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> property, gives you a way to integrate custom verbs into your controls. The <xref:System.Web.UI.WebControls.WebParts.WebPart> class implements the <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface and implements its single property. To add custom verbs to a control that inherits from the <xref:System.Web.UI.WebControls.WebParts.WebPart> class, you must override the <xref:System.Web.UI.WebControls.WebParts.WebPart.Verbs%2A?displayProperty=nameWithType> property, add custom verbs to a collection, and return the collection. The collection referenced by the <xref:System.Web.UI.WebControls.WebParts.WebPart.Verbs%2A?displayProperty=nameWithType> property contains only custom verbs; standard verbs are not included in this collection. The default return value of the <xref:System.Web.UI.WebControls.WebParts.WebPart.Verbs%2A?displayProperty=nameWithType> property in a <xref:System.Web.UI.WebControls.WebParts.WebPart> control is `null`, because by default there are no custom verbs in the collection. |
| 23 | +
|
| 24 | + Adding custom verbs to server controls that are not <xref:System.Web.UI.WebControls.WebParts.WebPart> controls requires one extra step. In those cases, the controls must also implement the <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface and implement the <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> property. |
| 25 | +
|
| 26 | + After you have added custom verbs to the <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> collection, the Web Parts control set automatically handles the other steps necessary to create and render the custom verbs. |
| 27 | +
|
| 28 | +
|
| 29 | +
|
| 30 | +## Examples |
| 31 | + The following code example demonstrates a simple implementation of the <xref:System.Web.UI.WebControls.WebParts.IWebActionable> interface. The first part of the code example shows how the interface is implemented in a user control. The user control implements the <xref:System.Web.UI.WebControls.WebParts.IWebActionable.Verbs%2A> property by creating two custom verbs and defining a method that is called when a user clicks either of the verbs. For simplicity, the same method is used for both verbs. The method updates the value of a property named `VerbCounterClicks`. The code for the `Page_Load` method accesses the <xref:System.Web.UI.WebControls.WebParts.GenericWebPart.Verbs%2A> property of the control to display the total count of custom verbs in the collection. This count does not include the standard Web Parts verbs. |
| 32 | +
|
33 | 33 | > [!IMPORTANT]
|
34 |
| -> This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see [Script Exploits Overview](https://msdn.microsoft.com/library/772c7312-211a-4eb3-8d6e-eec0aa1dcc07). |
35 |
| - |
| 34 | +> This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see [Script Exploits Overview](https://docs.microsoft.com/previous-versions/aspnet/w1sw53ds(v=vs.100)). |
| 35 | +
|
36 | 36 | [!code-aspx-csharp[WebParts_IWebActionable_Overview#2](~/samples/snippets/csharp/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/CS/usercontrolverbcs.ascx#2)]
|
37 |
| - [!code-aspx-vb[WebParts_IWebActionable_Overview#2](~/samples/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/VB/usercontrolverbvb.ascx#2)] |
38 |
| - |
39 |
| - The second part of the code example is an .aspx page that hosts the user control. Because the control is referenced in a <xref:System.Web.UI.WebControls.WebParts.WebPartZone> control, at run time ASP.NET wraps the user control in a <xref:System.Web.UI.WebControls.WebParts.GenericWebPart> control and treats it as a <xref:System.Web.UI.WebControls.WebParts.WebPart> control. After you load the page in a browser, notice that the label at the bottom of the control displays how many custom verbs are in the collection referenced by the <xref:System.Web.UI.WebControls.WebParts.GenericWebPart.Verbs%2A> property. Also note that if you click the verbs menu in the control, and click either of the verbs, another label appears showing the total number of times the custom verbs have been clicked. |
40 |
| - |
| 37 | + [!code-aspx-vb[WebParts_IWebActionable_Overview#2](~/samples/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/VB/usercontrolverbvb.ascx#2)] |
| 38 | +
|
| 39 | + The second part of the code example is an .aspx page that hosts the user control. Because the control is referenced in a <xref:System.Web.UI.WebControls.WebParts.WebPartZone> control, at run time ASP.NET wraps the user control in a <xref:System.Web.UI.WebControls.WebParts.GenericWebPart> control and treats it as a <xref:System.Web.UI.WebControls.WebParts.WebPart> control. After you load the page in a browser, notice that the label at the bottom of the control displays how many custom verbs are in the collection referenced by the <xref:System.Web.UI.WebControls.WebParts.GenericWebPart.Verbs%2A> property. Also note that if you click the verbs menu in the control, and click either of the verbs, another label appears showing the total number of times the custom verbs have been clicked. |
| 40 | +
|
41 | 41 | [!code-aspx-csharp[WebParts_IWebActionable_Overview#1](~/samples/snippets/csharp/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/CS/usercontrolverbhostcs.aspx#1)]
|
42 |
| - [!code-aspx-vb[WebParts_IWebActionable_Overview#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/VB/usercontrolverbhostvb.aspx#1)] |
43 |
| - |
| 42 | + [!code-aspx-vb[WebParts_IWebActionable_Overview#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/VB/usercontrolverbhostvb.aspx#1)] |
| 43 | +
|
44 | 44 | ]]></format>
|
45 | 45 | </remarks>
|
46 | 46 | <altmember cref="P:System.Web.UI.WebControls.WebParts.WebPart.Verbs" />
|
|
68 | 68 | <summary>Gets a reference to a collection of custom <see cref="T:System.Web.UI.WebControls.WebParts.WebPartVerb" /> objects.</summary>
|
69 | 69 | <value>A <see cref="T:System.Web.UI.WebControls.WebParts.WebPartVerbCollection" /> that contains custom <see cref="T:System.Web.UI.WebControls.WebParts.WebPartVerb" /> objects.</value>
|
70 | 70 | <remarks>
|
71 |
| - <format type="text/markdown"><]
|
88 |
| - [!code-vb[WebParts_IWebActionable_Overview#3](~/samples/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/VB/usercontrolverbvb.ascx#3)] |
89 |
| - |
| 88 | + [!code-vb[WebParts_IWebActionable_Overview#3](~/samples/snippets/visualbasic/VS_Snippets_WebNet/WebParts_IWebActionable_Overview/VB/usercontrolverbvb.ascx#3)] |
| 89 | +
|
90 | 90 | ]]></format>
|
91 | 91 | </remarks>
|
92 | 92 | <altmember cref="P:System.Web.UI.WebControls.WebParts.WebPart.Verbs" />
|
|
0 commit comments