ControlDesigner.GetErrorDesignTimeHtml(Exception) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 예외에 대한 정보를 제공하는 HTML 태그를 검색합니다.
protected:
virtual System::String ^ GetErrorDesignTimeHtml(Exception ^ e);
protected virtual string GetErrorDesignTimeHtml (Exception e);
abstract member GetErrorDesignTimeHtml : Exception -> string
override this.GetErrorDesignTimeHtml : Exception -> string
Protected Overridable Function GetErrorDesignTimeHtml (e As Exception) As String
매개 변수
발생한 예외입니다.
반환
지정된 예외에 대한 디자인 타임 HTML 태그입니다.
예제
다음 코드 예제에서는 오류가 발생할 때 컨트롤에 대 한 디자인 타임 HTML 태그를 생성 하 고 메서드를 호출 하는 CreatePlaceHolderDesignTimeHtml 방법을 보여 줍니다.
// 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
설명
메서드에서 GetErrorDesignTimeHtml 예외가 throw되는 경우 일반적으로 메서드가 GetDesignTimeHtml 호출됩니다.
상속자 참고
일반적인 디자인 패턴은 연결된 컨트롤을 통해 HTML 태그를 가져오는 것입니다. 그런 다음 오류가 발생하면 메서드를 호출합니다 GetErrorDesignTimeHtml(Exception) . 컨트롤에서 태그를 반환하지 않으면 메서드를 호출 GetEmptyDesignTimeHtml() 합니다. 이 메서드는 특정 태그를 제공하기 위해 재정의되지 않은 경우 컨트롤의 형식 및 ID에 대한 정보를 포함해야 하는 메서드를 호출 CreatePlaceHolderDesignTimeHtml() 합니다.