ValidationSummary.EnableClientScript 属性

定义

获取或设置一个值,用于指示 ValidationSummary 控件是否使用客户端脚本更新自身。

public:
 property bool EnableClientScript { bool get(); void set(bool value); };
public bool EnableClientScript { get; set; }
[System.Web.UI.Themeable(false)]
public bool EnableClientScript { get; set; }
member this.EnableClientScript : bool with get, set
[<System.Web.UI.Themeable(false)>]
member this.EnableClientScript : bool with get, set
Public Property EnableClientScript As Boolean

属性值

Boolean

如果 ValidationSummary 控件使用客户端脚本更新自身,则为 true;否则为 false。 默认值为 true

属性

示例

下面的代码示例演示如何使用 EnableClientScript 属性来阻止 ValidationSummary 控件使用客户端脚本来更新自身。


<asp:ValidationSummary 
     id="valSum" 
     DisplayMode="BulletList"
     EnableClientScript="false"
     ShowMessageBox="false"
     ShowSummary="true" 
     HeaderText="You must enter a value in the following fields:"
     Font-Names="verdana" 
     Font-Size="12"
     runat="server"/>

<asp:ValidationSummary 
     id="valSum" 
     DisplayMode="BulletList"
     EnableClientScript="false"
     ShowMessageBox="false"
     ShowSummary="true" 
     HeaderText="You must enter a value in the following fields:"
     Font-Names="verdana" 
     Font-Size="12"
     runat="server"/>

注解

使用此属性可指定控件是否 ValidationSummary 使用客户端脚本自行更新。 当此属性设置为 true时,客户端脚本将在客户端上呈现,以更新 ValidationSummary 控件(如果浏览器支持该功能)。 当此属性设置为 false时,客户端上不会呈现任何客户端脚本,并且 ValidationSummary 控件仅在往返服务器时自行更新。 在这种情况下,该 ShowMessageBox 属性不起作用。

无法通过主题或样式表主题设置此属性。 有关详细信息,请参阅ThemeableAttributeASP.NET 主题和外观

适用于

另请参阅