CheckBoxDesigner.GetDesignTimeHtml Method ()
.NET Framework 2.0
Gets the markup that is used to represent the control at design time.
Namespace: System.Web.UI.Design.WebControls
Assembly: System.Design (in system.design.dll)
CheckBoxDesigner Members
System.Web.UI.Design.WebControls Namespace
Walkthrough: Creating a Basic Control Designer for a Web Server Control
ASP.NET Control Designers Overview
Walkthrough: Creating a Basic Control Designer for a Web Server Control
Assembly: System.Design (in system.design.dll)
The following code example overrides the GetDesignTimeHtml method. If the CheckBox.Text property has not been set previously, a call to this method sets it to a string and displays that string on the design surface. If the Text property has already been set, the existing property value is displayed.
' Override the GetDesignTimeHtml method to display a border on the ' control if the BorderStyle property has not been set by the user. Public Overrides Function GetDesignTimeHtml() As String Dim sampleCheckBox As SampleCheckBox = CType(Component, _ SampleCheckBox) Dim designTimeHtml As String = Nothing ' Check the control's BorderStyle property. If (sampleCheckBox.BorderStyle = BorderStyle.NotSet) Then ' Save the current value of the BorderStyle property. Dim oldBorderStyle As BorderStyle = _ sampleCheckBox.BorderStyle ' Change the value of the BorderStyle property and ' generate the design-time HTML. Try sampleCheckBox.BorderStyle = BorderStyle.Groove designTimeHtml = MyBase.GetDesignTimeHtml() ' If an exception occurs, call the GetErrorDesignTimeHtml ' method. Catch ex As Exception designTimeHtml = GetErrorDesignTimeHtml(ex) ' Restore the BorderStyle property to its original value. Finally sampleCheckBox.BorderStyle = oldBorderStyle End Try Else designTimeHtml = MyBase.GetDesignTimeHtml() End If Return designTimeHtml End Function
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Reference
CheckBoxDesigner ClassCheckBoxDesigner Members
System.Web.UI.Design.WebControls Namespace
Other Resources
ASP.NET Control Designers OverviewWalkthrough: Creating a Basic Control Designer for a Web Server Control
ASP.NET Control Designers Overview
Walkthrough: Creating a Basic Control Designer for a Web Server Control
Show: