Assembly: System.Web (in system.web.dll)
protected virtual ErrorWebPart CreateErrorWebPart ( string originalID, string originalTypeName, string originalPath, string genericWebPartID, string errorMessage )
protected ErrorWebPart CreateErrorWebPart ( String originalID, String originalTypeName, String originalPath, String genericWebPartID, String errorMessage )
protected function CreateErrorWebPart ( originalID : String, originalTypeName : String, originalPath : String, genericWebPartID : String, errorMessage : String ) : ErrorWebPart
A string that is the ID of the failing control. If a GenericWebPart is involved in the failure, the ID is the ID of its child server control.
A string that is the name of the Type of the failed control. If a GenericWebPart is involved in the failure, the type name is the type of its child server control.
A string that contains the path to a user control, if a GenericWebPart that contains a child user control is involved in the failure.
A string that returns the ID of a GenericWebPart, if that type of control was involved in the failure to load or create a control.
A string that contains the error message to display on the page.
Return ValueAn ErrorWebPart that is inserted into a page in place of a control that failed to be loaded or created.
The CreateErrorWebPart method is called when the Web Parts control set attempts to load or create an instance of a dynamic WebPart or server control, and it fails for some reason. The method creates an ErrorWebPart object, assigns an error message to it, and returns it. The ErrorWebPart control is inserted in place of the control that failed, and its error message is displayed on the page.
You cannot call the CreateErrorWebPart method directly from your code. However, you can inherit from the WebPartManager class and extend the method. For details, see the Notes for Inheritors section.
End users can work with an ErrorWebPart control in a page much like they would a normal WebPart control. To remove the error message, they can close the control by clicking the close verb, at which point the control will be added to a PageCatalogPart object, like any other closed control. If an end user deletes an ErrorWebPart control, the server control that failed to load will also be deleted from the page.Notes to Inheritors: If you want to customize the information that is returned in the ErrorWebPart control, you can override the CreateErrorWebPart method, call the base method, assign different values to the parameters passed to the base method, and then return the resulting ErrorWebPart control. For example, if you do not want end users to see the originalPath value (which would show the virtual directory path of a user control), when you call the base method you could pass an empty string ("") for that parameter. You can also customize the behavior of the ErrorWebPart control itself, by inheriting from it. For example, you might want to override its Title or AllowMinimize property.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.