Export (0) Print
Expand All

ControlDesigner.GetDesignTimeHtml Method

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

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

Return Value

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

Example

[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)
      
      Try
         control.DataSource = designTimeDataSource
         control.DataBind()
         
         designTimeHtml = MyBase.GetDesignTimeHtml()
      Finally
         control.DataSource = Nothing
      End Try
   Else
      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.

Requirements

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

.NET Framework Security: 

See Also

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

Show:
© 2014 Microsoft