HiddenFieldDesigner.GetDesignTimeHtml 方法

定義

取得在設計階段用來呈現關聯控制項的標記。

public:
 override System::String ^ GetDesignTimeHtml();
public override string GetDesignTimeHtml ();
override this.GetDesignTimeHtml : unit -> string
Public Overrides Function GetDesignTimeHtml () As String

傳回

String

字串,包含在設計階段用來呈現 HiddenField 的標記。

範例

下列程式碼範例示範如何在設計階段覆寫 GetDesignTimeHtml 繼承自 類別的 HiddenFieldDesigner 類別中的 方法,以變更控制項的外觀 HiddenField 。 覆 GetDesignTimeHtml 寫會產生預留位置,其中包含 Value 預留位置中的 屬性,以及控制項類別名稱和 ID 屬性。

// Generate the design-time markup.
public override string GetDesignTimeHtml()
{
    // Get a reference to the control or a copy of the control.
    MyHiddenField myHF = (MyHiddenField)ViewControl;

    // Create a placeholder that displays the control value.
    string markup = CreatePlaceHolderDesignTimeHtml(
         "Value: \"" + myHF.Value.ToString() + "\"" );

    return markup;
} // GetDesignTimeHtml
' Generate the design-time markup.
Public Overrides Function GetDesignTimeHtml() As String

    ' Get a reference to the control or a copy of the control.
    Dim myHF As MyHiddenField = CType(ViewControl, MyHiddenField)

    Dim markup As String = _
        CreatePlaceHolderDesignTimeHtml( _
            "Value: """ & myHF.Value.ToString() & """" )

    Return markup

End Function ' GetDesignTimeHtml

備註

方法 GetDesignTimeHtml 會產生預留位置的標記,其中包含控制項類別名稱和 ID 屬性。

適用於

另請參閱