ValidationSummary.EnableClientScript 屬性

定義

取得或設定值,指出 ValidationSummary 控制項是否使用用戶端指令碼自行更新。Gets or sets a value indicating whether the ValidationSummary control updates itself using client-side script.

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,否則為 falsetrue if the ValidationSummary control updates itself using client-side script; otherwise, false. 預設為 trueThe default is true.

屬性

範例

下列程式碼範例示範如何使用 EnableClientScript 屬性,以防止 ValidationSummary 控制項使用用戶端腳本自行更新。The following code example demonstrates how to use the EnableClientScript property to prevent the ValidationSummary control from using client-side script to update itself.


<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 控制項是否會使用用戶端腳本自行更新。Use this property to specify whether the ValidationSummary control updates itself using client-side script. 當這個屬性設定為時 trueValidationSummary 如果瀏覽器支援該功能,用戶端腳本會在用戶端上呈現以更新控制項。When this property is set to true, client-side script is rendered on the client to update the ValidationSummary control, if the browser supports that feature. 當這個屬性設定為時 false ,不會在用戶端上呈現用戶端腳本,而且 ValidationSummary 控制項只會在往返伺服器時自行更新。When this property is set to false, no client-side script is rendered on the client and the ValidationSummary control only updates itself on round trips to the server. 在此情況下, ShowMessageBox 屬性不會有任何作用。In this situation, the ShowMessageBox property has no effect.

這個屬性無法由佈景主題或樣式表主題設定。This property cannot be set by themes or style sheet themes. 如需詳細資訊,請參閱 ThemeableAttributeASP.NET 主題和外觀For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

適用於

另請參閱