Share via


LoginDesigner.GetErrorDesignTimeHtml(Exception) メソッド

定義

エラーが発生した場合に、関連付けられたコントロールのデザイン時表示に使用するマークアップを提供します。

protected:
 override System::String ^ GetErrorDesignTimeHtml(Exception ^ e);
protected override string GetErrorDesignTimeHtml (Exception e);
override this.GetErrorDesignTimeHtml : Exception -> string
Protected Overrides Function GetErrorDesignTimeHtml (e As Exception) As String

パラメーター

e
Exception

スローされた Exception

戻り値

エラーが発生した後で、関連付けられた Login のデザイン時表示に使用するマークアップを含んだ文字列。

次のコード例は、 クラスから継承されたクラスの メソッドをオーバーライド GetErrorDesignTimeHtml して、デザイン時にコントロールから LoginDesigner 派生したコントロールの外観を変更する方法を Login 示しています。 この例では、赤い太字のテキストでレンダリングされるエラー メッセージを含むプレースホルダーのマークアップを生成します。

// Generate the design-time markup for the control when an error occurs.
protected override string GetErrorDesignTimeHtml(Exception e) 
{
    // Write the error message text in red, bold.
    string errorRendering =
        "<span style=\"font-weight:bold; color:Red; \">" +
        e.Message + "</span>";

    return CreatePlaceHolderDesignTimeHtml(errorRendering);
} // GetErrorDesignTimeHtml
' Generate the design-time markup for the control when an error occurs.
Protected Overrides Function GetErrorDesignTimeHtml( _
    ByVal ex As Exception) As String

    ' Write the error message text in red, bold.
    Dim errorRendering As String = _
        "<span style=""font-weight:bold; color:Red; "">" & _
        ex.Message & "</span>"

    Return CreatePlaceHolderDesignTimeHtml(errorRendering)

End Function ' GetErrorDesignTimeHtml

注釈

デザイン時 Login コントロールがレンダリングするプレースホルダーには、型名、コントロール名、およびエラーを発表および説明するメッセージが含まれています。

適用対象

こちらもご覧ください