ValidationSummary.ShowMessageBox 屬性

定義

取得或設定值,指出是否在訊息方塊中顯示驗證摘要。

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

屬性值

如果在訊息方塊中顯示驗證摘要,則為 true,否則為 false。 預設為 false

屬性

範例

下列程式碼範例示範如何使用 ShowMessageBoxShowSummary 屬性來指定驗證摘要只會顯示在訊息方塊中。


<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 這個屬性來控制驗證摘要的顯示位置。 如果這個屬性和 EnableClientScript 都設定為 true ,驗證摘要會顯示在訊息方塊中。 如果 EnableClientScript 設定為 false ,則此屬性沒有作用。

注意

ShowMessageBox如果 和 ShowSummary 屬性都設定 true 為 ,驗證摘要會顯示在訊息方塊和網頁上。

適用於

另請參閱