ControlDesigner.GetErrorDesignTimeHtml(Exception) Yöntem

Tanım

Belirtilen özel durum hakkında bilgi sağlayan HTML işaretlemesini alır.

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

Parametreler

e
Exception

Oluşan özel durum.

Döndürülenler

String

Belirtilen özel durum için tasarım zamanı HTML işaretlemesi.

Örnekler

Aşağıdaki kod örneği, bir hata oluştuğunda denetim için tasarım zamanı HTML işaretlemesi oluşturmayı ve yöntemini çağırmayı CreatePlaceHolderDesignTimeHtml gösterir.

// 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

Açıklamalar

yönteminde GetErrorDesignTimeHtml bir özel durum oluşursa yöntemi genellikle çağrılır GetDesignTimeHtml .

Devralanlara Notlar

Tipik tasarım deseni, ilişkili denetim aracılığıyla HTML işaretlemesi almaya çalışmaktır ve hatayla karşılaşılırsa yöntemini çağırın GetErrorDesignTimeHtml(Exception) . Denetim tarafından hiçbir işaretleme döndürülmezse, yöntemini çağırın GetEmptyDesignTimeHtml() ; belirli bir işaretleme sağlamak için geçersiz kılınmazsa, denetimin CreatePlaceHolderDesignTimeHtml() türü ve kimliği hakkında bilgi içermesi gereken yöntemini çağırır.

Şunlara uygulanır

Ayrıca bkz.