DataGridDesigner.GetErrorDesignTimeHtml(Exception) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當渲染控制項時遇到錯誤時,會顯示指定例外的 HTML 標記。
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
參數
那個例外發生了。
傳回
在設計時為指定例外顯示的 HTML 標記。
範例
以下程式碼範例說明如何在異常發生時覆寫 GetErrorDesignTimeHtml 修改控制項在設計表面外觀 DataGrid 的方法。
此程式碼範例是本類別更大範例 DataGridDesigner 的一部分。
Protected Overrides Function GetEmptyDesignTimeHtml() As String
Dim emptyText As String
' Check the CanEnterTemplateMode property to
' specify which text to display if ItemTemplate
' does not contain a value.
If CanEnterTemplateMode Then
emptyText = _
"<b>Either the Enabled property value is false " + _
"or you need to set the ItemTemplate for this " + _
"control.<br>Right-click to edit templates.</b>"
Else
emptyText = _
"<b>You cannot edit templates in this view.<br>" + _
"Switch to HTML view to define the ItemTemplate.</b>"
End If
Return CreatePlaceHolderDesignTimeHtml(emptyText)
End Function