HiddenFieldDesigner.GetDesignTimeHtml 方法      
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取用于在设计时呈现关联控件的标记。
public:
 override System::String ^ GetDesignTimeHtml();public override string GetDesignTimeHtml();override this.GetDesignTimeHtml : unit -> stringPublic Overrides Function GetDesignTimeHtml () As 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 属性的占位符生成标记。