GetDesignTimeHtml Method (DesignerRegionCollect...
.NET Framework Class Library
ControlDesigner..::.GetDesignTimeHtml Method (DesignerRegionCollection)

Retrieves the HTML markup to display the control and populates the collection with the current control designer regions.

Namespace:  System.Web.UI.Design
Assembly:  System.Design (in System.Design.dll)
Visual Basic (Declaration)
Public Overridable Function GetDesignTimeHtml ( _
    regions As DesignerRegionCollection _
) As String
Visual Basic (Usage)
Dim instance As ControlDesigner
Dim regions As DesignerRegionCollection
Dim returnValue As String

returnValue = instance.GetDesignTimeHtml(regions)
C#
public virtual string GetDesignTimeHtml(
    DesignerRegionCollection regions
)
Visual C++
public:
virtual String^ GetDesignTimeHtml(
    DesignerRegionCollection^ regions
)
JScript
public function GetDesignTimeHtml(
    regions : DesignerRegionCollection
) : String

Parameters

regions
Type: System.Web.UI.Design..::.DesignerRegionCollection
A collection of control designer regions for the associated control.

Return Value

Type: System..::.String
The design-time HTML markup for the associated control, including all control designer regions.

The design host calls the GetDesignTimeHtml method to get the design-time HTML markup and the current list of control designer regions. Using the DesignerRegionCollection, the design host can then request the markup for each editable control designer region.

The GetDesignTimeHtml method is provided for a derived control designer, such as the GridViewDesigner class, that must process the content for the region before calling the GetDesignTimeHtml method.

The following code example shows how to create HTML markup using the DesignerRegionCollection collection.

Visual Basic
' Create the regions and design-time markup. Called by the designer host.
Public Overrides Function GetDesignTimeHtml(ByVal regions As DesignerRegionCollection) As String
    ' Create 3 regions: 2 clickable headers and an editable row
    regions.Add(New DesignerRegion(Me, "Header0"))
    regions.Add(New DesignerRegion(Me, "Header1"))

    ' Create an editable region and add it to the regions
    Dim editableRegion As EditableDesignerRegion = _
        New EditableDesignerRegion(Me, _
            "Content" & myControl.CurrentView, False)
    regions.Add(editableRegion)

    ' Set the highlight for the selected region
    regions(myControl.CurrentView).Highlight = True

    ' Use the base class to render the markup
    Return MyBase.GetDesignTimeHtml()
End Function
C#
// Create the regions and design-time markup. Called by the designer host.
public override String GetDesignTimeHtml(DesignerRegionCollection regions) {
    // Create 3 regions: 2 clickable headers and an editable row
    regions.Add(new DesignerRegion(this, "Header0"));
    regions.Add(new DesignerRegion(this, "Header1"));

    // Create an editable region and add it to the regions
    EditableDesignerRegion editableRegion = 
        new EditableDesignerRegion(this, 
            "Content" + myControl.CurrentView, false);
    regions.Add(editableRegion);

    // Set the highlight for the selected region
    regions[myControl.CurrentView].Highlight = true;

    // Use the base class to render the markup
    return base.GetDesignTimeHtml();
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
Page view tracker