📜  ASP.Net WebForm验证摘要

📅  最后修改于: 2020-12-28 00:41:07             🧑  作者: Mango

ASP.NET验证摘要控件

该验证器用于显示Web表单中所有验证错误的列表。

它使我们能够在单个位置汇总错误消息。

我们可以设置DisplayMode属性以将错误消息显示为列表,项目符号列表或单个段落。

验证摘要属性

此控件具有以下属性。

Property Description
AccessKey It is used to set keyboard shortcut for the control.
BackColor It is used to set background color of the control.
BorderColor It is used to set border color of the control.
Font It is used to set font for the control text.
ForeColor It is used to set color of the control text.
Text It is used to set text to be shown for the control.
ToolTip It displays the text when mouse is over the control.
Visible To set visibility of control on the form.
Height It is used to set height of the control.
Width It is used to set width of the control.
ShowMessageBox It displays a message box on error in up-level browsers.
ShowSummary It is used to show summary text on the form page.
ShowValidationErrors It is used to set whether the validation summary should be shown or not.

以下示例说明了如何在应用程序中使用ValidationSummery控件。

// ValidationSummeryDemo.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ValidationSummeryDemo.aspx.cs" 
Inherits="asp.netexample.ValidationSummeryDemo" %>






User Name *
Password *


输出:

在浏览器中查看时,它将产生以下输出。

当没有凭据的用户登录时,它将引发错误摘要。