ResourceExpressionEditorSheet 類別

定義

表示設計階段設計工具主應用程式 (Designer Host) 的 UI 中之資源運算式屬性的設計階段編輯器工作表。

public ref class ResourceExpressionEditorSheet : System::Web::UI::Design::ExpressionEditorSheet
public class ResourceExpressionEditorSheet : System.Web.UI.Design.ExpressionEditorSheet
type ResourceExpressionEditorSheet = class
    inherit ExpressionEditorSheet
Public Class ResourceExpressionEditorSheet
Inherits ExpressionEditorSheet
繼承
ResourceExpressionEditorSheet

範例

下列程式碼範例示範如何使用 將 控制項的 HyperLink 屬性系結 Text 至資源運算式 ResourceExpressionEditor 。 若要使用範例:

  1. 在網站專案中,將名為 Strings.resx 的新資源檔新增至 App_GlobalResources 資料夾。

  2. 將名為 myLinkText 的字串新增至 Strings.resx 資源檔,並將值設定為控制項的 HyperLink 文字。 例如,將 myLinkText 字串值設定為 This is a link

  3. 在 ASP.NET 網頁中,新增 HyperLink 控制項。

  4. 在控制項的屬性方格 Hyperlink 中,按一下 [ 運算式],然後按一下省略號按鈕 (...) 以顯示運算式系結對話方塊。

  5. Text選取控制項的 屬性,並將 [運算式類型] 設定為 Resources 運算式類型。 視覺化設計工具會顯示 物件所 ResourceExpressionEditorSheet 定義的資源運算式屬性。

  6. 設定 運算式屬性 ,如下所示:

    • ClassKey 設定為 Strings ,這是已編譯 Strings.resx 資源檔的類別名稱。

    • ResourceKey 設定為 myLinkText ,即 Strings.resx 中的字串名稱。

視覺化設計工具會 ResourceExpressionEditor 使用 物件來指派 屬性的資源運算式 Text 。 下列 aspx 來源顯示使用資源運算式設定的屬性值範例:

<!-- 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>
<!-- 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>

備註

視覺化設計工具會 ResourceExpressionEditor 使用 類別搭配 ResourceExpressionEditorSheet 類別來選取資源參考運算式的個別屬性,並將選取的資源運算式屬性值結合到資源運算式中。

ConnectionStringsExpressionEditor.GetExpressionEditorSheet 方法會傳回 ResourceExpressionEditorSheet 物件。 在運算式對話方塊中,當您選取控制項屬性並將它系結至資源運算式時,視覺化設計工具會呼叫 GetExpressionEditorSheet 方法。 視覺化設計工具會使用傳 ResourceExpressionEditorSheet 回的物件來提示 ClassKeyResourceKey 屬性。 選取資源運算式屬性之後,視覺化設計工具會 GetExpression 呼叫 方法,將屬性結合到資源運算式字串中。

屬性 ResourceKey 必須在資源運算式中指定;它會為資源值編制索引。 ClassKey 是選用屬性。 它會參考類別索引鍵或檔案名,以定義全域資源資料夾中的資源。

建構函式

ResourceExpressionEditorSheet(String, IServiceProvider)

初始化 ResourceExpressionEditorSheet 類別的新執行個體。

屬性

ClassKey

取得或設定索引鍵,與專案之全域資源資料夾中的資源檔名相符。

IsValid

取得值,這個值表示資源運算式字串是否有效。

ResourceKey

取得或設定資源名稱,這個名稱會做為尋找資源值的索引鍵。

ServiceProvider

取得由運算式編輯器工作表使用的服務提供者實作。

(繼承來源 ExpressionEditorSheet)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetExpression()

傳回資源運算式,此項目是由運算式編輯器的工作表屬性值所構成。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱