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
public override string GetDesignTimeHtml();
public: String* GetDesignTimeHtml();
public override 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 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.
        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
    ' Set the properties to original state.
        simpleRadioButtonList.BackColor = oldBackColor
    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.


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