ErrorWebPart.ErrorMessage Property

Definition

Gets or sets the error message that is displayed in a Web page in place of a control that could not be successfully added to the page.

C#
public string ErrorMessage { get; set; }

Property Value

A string that contains the text of the error message. The default value is a culture-specific error message.

Remarks

The ErrorMessage property can be assigned a value by a developer, so that a custom error message is displayed at the point where the ErrorWebPart control is inserted into a page.

Notes to Inheritors

Developers can assign a default value to the ErrorMessage property by extending the ErrorWebPart class and, in the ErrorWebPart(String, String, String, String) constructor or in an overridden EndLoadPersonalization() method, assigning a default value to the property.

To require the WebPartManager control to use a custom ErrorWebPart control, you must also inherit from the WebPartManager class and override its CreateErrorWebPart(String, String, String, String, String) method. In that method, you should assign the value of the method's errorMessage parameter to the ErrorMessage property of your custom ErrorWebPart control, because the WebPartManager control calls this method from several other places, and usually passes in a specific error message.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also