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.v20.2.dll

NuGet Package: DevExpress.Web.Scheduler

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

Use the CustomErrorText event to specify the default error text of the exception.

Use the ErrorText property to specify the error text for the exception object returned by the Exception property. Refer to the ErrorText property to get information on the error text’s pattern.

Example

View Example

The following example illustrates how to handle the ASPxScheduler.CustomErrorText event to display custom text when an unhandled exception occurs:

using DevExpress.Web.ASPxScheduler;
using DevExpress.XtraScheduler;
    protected void ASPxScheduler1_CustomErrorText(object handler, ASPxSchedulerCustomErrorTextEventArgs e) {
        e.ErrorText = ErrorTextHelper.PrepareMessage("Please contact Technical Support", e.Exception.Message, true);       
    }
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