設定或傳回能連結至錯誤表單的驗證摘要的字串。預設值是 String.Empty。
public string BackLabel {
get,
set
}
備註
呈現表單時如果發生錯誤,驗證處理序會使用 BackLabel 屬性中的文字作為驗證摘要頁上顯示的字串。
範例
下列範例示範如何使用 BackLabel 屬性覆寫 ValidationSummary 控制項中連結的預設文字以回到錯誤表單。
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' ErrorMessages appear in ValidationSummary control.
RequiredFieldValidator1.ErrorMessage = "Username Was A must Field"
RequiredFieldValidator2.ErrorMessage = "Password Was A must Field"
' Change the dafault text to link back to the
' ValidationSummary control.
ValidationSummary1.BackLabel = "Back to Main Form"
End Sub
[C#]
void Page_Load(Object sender, EventArgs e)
{
// ErrorMessages appear in ValidationSummary control.
RequiredFieldValidator1.ErrorMessage = "Username Was A must Field";
RequiredFieldValidator2.ErrorMessage = "Password Was A must Field";
// Change the dafault text to link back to the
// ValidationSummary control.
ValidationSummary1.BackLabel="Back to Main Form";
}