This documentation is archived and is not being maintained.

ControlDesigner.GetDesignTimeHtml Method

Gets the HTML that is used to represent the control at design time.

[Visual Basic]
Public Overridable Function GetDesignTimeHtml() As String
public virtual string GetDesignTimeHtml();
public: virtual String* GetDesignTimeHtml();
public function GetDesignTimeHtml() : String;

Return Value

The HTML that is used to represent the control at design time.


[Visual Basic] The following code example overrides the GetDesignTimeHtml method in a templated data-bound control designer. It determines whether the control supported by this designer has templates, and if it does, displays the templates in the designer. If the controls does not contain templates, the GetEmptyDesignTimeHtml method is called and the value it generates is displayed in the designer.

[Visual Basic] 
' Override the GetDesignTimeHtml method to display templates
' in the designer if they exist.
Public Overrides Function GetDesignTimeHtml() As String
   Dim control As TemplatedList = CType(Component, TemplatedList)
   Dim designTimeHtml As String = Nothing
   Dim hasATemplate As Boolean = Me.TemplatesExist
   If hasATemplate Then
      Dim dummyDataSource As Boolean
      Dim designTimeDataSource As IEnumerable = GetDesignTimeDataSource(5, dummyDataSource)
         control.DataSource = designTimeDataSource
         designTimeHtml = MyBase.GetDesignTimeHtml()
         control.DataSource = Nothing
      End Try
      designTimeHtml = GetEmptyDesignTimeHtml()
   End If
   Return designTimeHtml
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 Language Filter in the upper-left corner of the page.


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ControlDesigner Class | ControlDesigner Members | System.Web.UI.Design Namespace