Skip to main content

ASPxScheduler.CustomErrorText Event

Enables you to provide custom error descriptions.

Namespace: DevExpress.Web.ASPxScheduler

Assembly: DevExpress.Web.ASPxScheduler.v24.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

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

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

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