This documentation is archived and is not being maintained.

DataGridDesigner.GetErrorDesignTimeHtml Method

Gets the HTML displayed at design-time for the specified exception when an error has been encountered while rendering the control.

[Visual Basic]
Overrides Protected Function GetErrorDesignTimeHtml( _
   ByVal e As Exception _
) As String
[C#]
protected override string GetErrorDesignTimeHtml(
 Exception e
);
[C++]
protected: String* GetErrorDesignTimeHtml(
 Exception* e
);
[JScript]
protected override function GetErrorDesignTimeHtml(
   e : Exception
) : String;

Parameters

e
The exception to display an error message for.

Return Value

The HTML displayed at design-time for the specified exception.

Example

[Visual Basic] The following code example overrides the GetDesignTimeHtml method to set and display visual properties for the SimpleDataGrid class if its WebControl.BorderStyle property has not been set. The code uses Try...Catch...Finally syntax to set these properties. The Try section sets the BorderColor, BorderWidth, and CellPadding property values, the Catch section catches any exceptions and sends them to the GetErrorDesignTimeHtml method, and the Finally section returns the property values to their original state.

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

[Visual Basic] 
' Override the GetDesignTimeHtml method.
Public Overrides Function GetDesignTimeHtml() As String

   Dim designTimeHtml As String = Nothing      
   
   ' Check the control's BorderStyle property
   ' to conditionally render design-time HTML.
   If (simpleGrid.BorderStyle = BorderStyle.NotSet) Then

       ' Create variables to hold current property settings.
       Dim oldCellPadding As Integer = simpleGrid.CellPadding
       Dim oldBorderWidth As Unit = simpleGrid.BorderWidth
       Dim oldBorderColor As Color = simpleGrid.BorderColor
       
       ' Set properties and the design-time HTML.
       Try
           simpleGrid.CellPadding = 1
           simpleGrid.BorderWidth = Unit.Pixel(3)
           simpleGrid.BorderColor = Color.Brown
           designTimeHtml = MyBase.GetDesignTimeHtml()
             
       ' If an exception occurs, call the GetErrorDesignTimeHtml
       ' method.
       Catch ex As Exception
           designTimeHtml = GetErrorDesignTimeHtml(ex)

       ' Return properties to their original settings.
       Finally
           simpleGrid.CellPadding = oldCellPadding
           simpleGrid.BorderWidth = oldBorderWidth
           simpleGrid.BorderColor = oldBorderColor
       End Try
       
   Else
       designTimeHtml = MyBase.GetDesignTimeHtml()
   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

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

Show: