Export (0) Print
Expand All

ResourceExpressionEditorSheet Class

Represents a design-time editor sheet for the properties of a resource expression in the UI of a designer host at design time.

System.Object
  System.Web.UI.Design.ExpressionEditorSheet
    System.Web.UI.Design.ResourceExpressionEditorSheet

Namespace:  System.Web.UI.Design
Assembly:  System.Design (in System.Design.dll)

public class ResourceExpressionEditorSheet : ExpressionEditorSheet

The ResourceExpressionEditorSheet type exposes the following members.

  NameDescription
Public methodResourceExpressionEditorSheetInitializes a new instance of the ResourceExpressionEditorSheet class.
Top

  NameDescription
Public propertyClassKeyGets or sets the key that matches the filename for the resource in the project's global resource folder.
Public propertyIsValidGets a value that indicates whether the resource expression string is valid. (Overrides ExpressionEditorSheet.IsValid.)
Public propertyResourceKeyGets or sets the name of the resource, which is used as a key to find the resource value.
Public propertyServiceProviderGets the service provider implementation that is used by the expression editor sheet. (Inherited from ExpressionEditorSheet.)
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetExpressionReturns a resource expression that is formed by the expression editor sheet property values. (Overrides ExpressionEditorSheet.GetExpression().)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The visual designer uses the ResourceExpressionEditor class with the ResourceExpressionEditorSheet class to select the individual properties of a resource reference expression, and to combine the selected resource expression property values into a resource expression.

The ConnectionStringsExpressionEditor.GetExpressionEditorSheet method returns a ResourceExpressionEditorSheet object. In the expressions dialog box, when you select a control property and bind it to a resource expression, the visual designer calls the GetExpressionEditorSheet method. The visual designer uses the returned ResourceExpressionEditorSheet object to prompt for the ClassKey and ResourceKey properties. Once the resource expression properties are selected, the visual designer calls the GetExpression method to combine the properties into a resource expression string.

The ResourceKey property must be specified in a resource expression; it indexes the resource value. The ClassKey property is optional. It references the class key or file name that defines the resource in the global resources folder.

The following code example demonstrates how to bind the Text property of a HyperLink control to a resource expression using the ResourceExpressionEditor. To use the example:

  1. In a Web site project, add a new resource file named Strings.resx to the App_GlobalResources folder.

  2. Add a string named myLinkText to the Strings.resx resource file, and set the value to the text for a HyperLink control. For example, set the myLinkText string value to This is a link.

  3. In an ASP.NET Web page, add a HyperLink control.

  4. In the property grid for the Hyperlink control, click Expressions, and click the ellipsis button (...) to display the expression binding dialog box.

  5. Select the Text property of a control, and set Expression Type to the Resources expression type. The visual designer displays the resource expression properties defined by the ResourceExpressionEditorSheet object.

  6. Set the Expression Properties as follows:

    • Set ClassKey to Strings, the class name for the compiled Strings.resx resource file.

    • Set ResourceKey to myLinkText, the string name in Strings.resx.

The visual designer uses the ResourceExpressionEditor object to assign the resource expression for the Text property. The following aspx source shows an example of a property value set using a resource expression:


<!-- Define a hyperlink that maps the Text property to the
     myLinkText string value in the Strings.resx resource file. -->
<asp:HyperLink runat="server" ID="HyperLink2" 
     Text="<%$ Resources:Strings, myLinkText %>"
     NavigateUrl="http://www.microsoft.com"></asp:HyperLink>



<FileName>ControlsUsingExpressions.aspx</FileName>
<RelevantItems>
    <Reference>System.Web.UI.Design.ResourceExpressionEditor</Reference>
</RelevantItems>


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft