ValidationSummary.ShowMessageBox 屬性

定義

取得或設定值,指出是否在訊息方塊中顯示驗證摘要。Gets or sets a value indicating whether the validation summary is displayed in a message box.

public:
 property bool ShowMessageBox { bool get(); void set(bool value); };
[System.ComponentModel.Bindable(true)]
public bool ShowMessageBox { get; set; }
public bool ShowMessageBox { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ShowMessageBox : bool with get, set
member this.ShowMessageBox : bool with get, set
Public Property ShowMessageBox As Boolean

屬性值

Boolean

如果在訊息方塊中顯示驗證摘要,則為 true,否則為 falsetrue if the validation summary is to be displayed in a message box; otherwise, false. 預設為 falseThe default is false.

屬性

範例

下列程式碼範例示範如何使用 ShowMessageBox 和屬性, ShowSummary 指定驗證摘要只會顯示在訊息方塊中。The following code example demonstrates how to use the ShowMessageBox and ShowSummary properties to specify that the validation summary is displayed only in a message box.


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

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

備註

除了屬性之外,還可以使用這個屬性 ShowSummary 來控制驗證摘要的顯示位置。This property can be used in addition to the ShowSummary property to control where the validation summary is displayed. 如果這個屬性和都 EnableClientScript 是設定為 true ,則驗證摘要會顯示在訊息方塊中。If this property and EnableClientScript are both set to true, the validation summary is displayed in a message box. 如果 EnableClientScript 設定為 false ,則這個屬性不會有任何作用。If EnableClientScript is set to false, this property has no effect.

注意

如果 ShowMessageBoxShowSummary 屬性都設為 true ,則驗證摘要會顯示在訊息方塊和網頁上。If both the ShowMessageBox and ShowSummary properties are set to true, the validation summary is displayed in both a message box and on the Web page.

適用於

另請參閱