ControlDesigner.GetEmptyDesignTimeHtml Method
Gets the HTML that is used to represent an empty control at design time.
[Visual Basic] Protected Overridable Function GetEmptyDesignTimeHtml() As String [C#] protected virtual string GetEmptyDesignTimeHtml(); [C++] protected: virtual String* GetEmptyDesignTimeHtml(); [JScript] protected function GetEmptyDesignTimeHtml() : String;
Return Value
The HTML that is used to represent an empty control at design time. By default, this HTML contains the name of the component.
Remarks
The default behavior of this method is to return a string containing the name of the component. This method is called by GetDesignTimeHtml when there is no design-time HTML.
Example
[Visual Basic] The following code example overrides the GetEmptyDesignTimeHtml method in a templated control designer. The code checks the value of the TemplatedControlDesigner.CanEnterTemplateMode property, and, dependent upon the result, sets a string variable to one of two possible values. The resulting string is then passed as the instruction parameter in a call to the CreatePlaceHolderDesignTimeHtml method.
[Visual Basic]
' Override the GetEmptyDesignTimeHtml to check whether
' template mode can be used from the designer, and provide
' display messages for both cases.
Protected Overrides Function GetEmptyDesignTimeHtml() As String
Dim textValue As String
If CanEnterTemplateMode Then
textValue = "Right click and choose a set of templates to edit their content.<br>The ItemTemplate is required."
Else
textValue = "Switch to HTML view to edit the control's templates.<br>The ItemTemplate is required."
End If
Return CreatePlaceHolderDesignTimeHtml(textValue)
End Function
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
ControlDesigner Class | ControlDesigner Members | System.Web.UI.Design Namespace