Rediger

Del via


HiddenFieldDesigner.GetDesignTimeHtml Method

Definition

Gets the markup that is used to render the associated control at design time.

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

Returns

A string containing the markup used to render the HiddenField at design time.

Examples

The following code example shows how to override the GetDesignTimeHtml method in a class that is inherited from the HiddenFieldDesigner class to change the appearance of the HiddenField control at design time. The GetDesignTimeHtml override generates a placeholder that includes the Value property in the placeholder, along with the control class name and the ID property.

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

Remarks

The GetDesignTimeHtml method generates the markup for a placeholder that includes the control class name and the ID property.

Applies to

See also