This documentation is archived and is not being maintained.

ListControlDesigner.GetDesignTimeHtml Method

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

[Visual Basic]
Overrides Public Function GetDesignTimeHtml() As String
[C#]
public override string GetDesignTimeHtml();
[C++]
public: String* GetDesignTimeHtml();
[JScript]
public override 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 to customize the HTML displayed for the SimpleRadioButtonList class on a design surface. If the WebControl.BackColor property is not defined for the control, it is set to Gainsboro and the control is displayed with that background color. If the control contains ListItem controls or is data-bound, the code calls the base class's implementation of the GetDesignTimeHtml method. Otherwise, the code displays a string that instructs the user to define list items for the control. After this is done, the base implementation of the GetDesignTimeHtml method is called.

[Visual Basic] This code example is part of a larger example provided for the ListControlDesigner class.

[Visual Basic] 
' Create HTML to display the control
' on the design surface.
Overrides Public Function GetDesignTimeHtml() As String
    
    Dim designTimeHtml As String
    
    ' Create variables to access the control's
    ' item collection and back color. 
    Dim items As ListItemCollection = simpleRadioButtonList.Items
    Dim oldBackColor As Color = simpleRadioButtonList.BackColor
    
    ' Check property values and render HTML
    ' on the design surface accordingly.
    Try
        If (Color.op_Equality(oldBackColor, Color.Empty)) Then
            simpleRadioButtonList.BackColor = Color.Gainsboro
        End If

        If (changedDataSource) Then
            items.Add( _
                "Updated to new data source: " & DataSource ".")
        End If

        designTimeHtml = MyBase.GetDesignTimeHtml()
    
    ' Catch any exceptions that occur.
    Catch ex As Exception
        MyBase.GetErrorDesignTimeHtml(ex)
    
    ' Set the properties to original state.
    Finally
        simpleRadioButtonList.BackColor = oldBackColor
        items.Clear()
    End Try
    
    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

ListControlDesigner Class | ListControlDesigner Members | System.Web.UI.Design.WebControls Namespace

Show: