Skip to main content
A newer version of this page is available. .

ASPxScheduler.CustomErrorText Event

Enables you to provide custom error descriptions.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v19.2.dll

Declaration

public event ASPxSchedulerCustomErrorTextEventHandler CustomErrorText

Event Data

The CustomErrorText event's data class is ASPxSchedulerCustomErrorTextEventArgs. The following properties provide information specific to this event:

Property Description
ErrorText Gets or sets the explanatory text for the error.
Exception Gets the exception thrown.

Remarks

The CustomErrorText event occurs when an exception is raised within the ASPxScheduler, and allows you to change the default error text. You can localize error messages via this event.

Use the ASPxSchedulerCustomErrorTextEventArgs.ErrorText property of the event’s arguments object to specify the error text for the exception returned by the ASPxSchedulerCustomErrorTextEventArgs.Exception property.

The following code snippets illustrate a way of handling the ASPxScheduler.CustomErrorText event to display custom text when an unhandled exception occurs.

public class ErrorTextHelper {
    static string NewLinesToBr(string text) {
        text = text.Replace("\r", string.Empty);
        return text.Replace("\n", "<br/>");
    }
    public static string PrepareMessage(string subjectText, string detailInfoText, bool showDetailedErrorInfo) {
        string subject = String.Format("{0}\n", subjectText);
        string detailInfo = String.Format("Detailed information is included below.\n\n- {0}", detailInfoText);
        if(!showDetailedErrorInfo)
            detailInfo = String.Empty;
        subject = NewLinesToBr(HttpUtility.HtmlEncode(subject));
        detailInfo = NewLinesToBr(HttpUtility.HtmlEncode(detailInfo));
        return String.Format("{0},{1}|{2}{3}", subject.Length, detailInfo.Length, subject, detailInfo);
    }
}
See Also