Compartilhar via


ReplaceTokens(String) Method

The ReplaceTokens method of the WebPart class performs token replacement for a string, using the same algorithm used for URL-valued properties.

Parameters

input   A string that requires token replacement.

Return Value

The input string with token values replaced.

Remarks

The Web Part architecture provides token replacement for Web Part base class properties that are defined as URLs, which include the HelpLink, DetailLink, PartImageLarge, and PartImageSmall properties. When a Web Part is rendered, values of these properties are scanned for the tokens listed in the following table, and those tokens are replaced with the values described in the following table. The Web Part property value itself is not changed.

Token Replacement value
_WPR_ ClassResourcePath property
_WPQ_ Qualifier property
_LogonUser_ Request.ServerVariables( "LOGON_USER" )
_WPID_ ID property (Control.ID)

Example

The following code example returns the value of the ClassResourcePath property by replacing the _WPR_ token. To view a more extensive example that passes HTML and ECMAScript (Microsoft JScript or JavaScript) that contains _WPQ_ tokens to the ReplaceTokens method before rendering the controls and script for a Web Part, see the client-side example provided for the ICellProvider interface.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security