次の方法で共有


ValidationSummary.DisplayMode プロパティ

検証の概要の表示モードを取得または設定します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Property DisplayMode As ValidationSummaryDisplayMode
'使用
Dim instance As ValidationSummary
Dim value As ValidationSummaryDisplayMode

value = instance.DisplayMode

instance.DisplayMode = value
public ValidationSummaryDisplayMode DisplayMode { get; set; }
public:
property ValidationSummaryDisplayMode DisplayMode {
    ValidationSummaryDisplayMode get ();
    void set (ValidationSummaryDisplayMode value);
}
/** @property */
public ValidationSummaryDisplayMode get_DisplayMode ()

/** @property */
public void set_DisplayMode (ValidationSummaryDisplayMode value)
public function get DisplayMode () : ValidationSummaryDisplayMode

public function set DisplayMode (value : ValidationSummaryDisplayMode)
適用できません。

プロパティ値

ValidationSummaryDisplayMode 値の 1 つ。既定値は BulletList です。

例外

例外の種類 条件

ArgumentOutOfRangeException

表示モードが ValidationSummaryDisplayMode 値ではありません。

解説

このプロパティを使用して、ValidationSummary コントロールの表示形式を指定します。概要は、リスト、箇条書きリスト、または単一の段落として表示できます。

トピック 場所
方法 : ASP.NET サーバー コントロールに対する検証エラー メッセージの表示を制御する Visual Studio ASP .NET での Web アプリケーションの作成
方法 : ASP.NET サーバー コントロールに対する検証エラー メッセージの表示を制御する Visual Studio ASP .NET での Web アプリケーションの作成
方法 : ASP.NET サーバー コントロールに対する検証エラー メッセージの表示を制御する ASP .NET Web アプリケーションの作成

使用例

DisplayMode プロパティを設定して、箇条書きリストを表示する方法を次のコード例に示します。

セキュリティに関するメモセキュリティに関するメモ :

この例には、ユーザー入力を受け付けるテキスト ボックスがあります。これにより、セキュリティが脆弱になる可能性があります。既定では、ASP.NET Web ページによって、ユーザー入力にスクリプトまたは HTML 要素が含まれていないかどうかが検証されます。詳細については、「スクリプトによる攻略の概要」を参照してください。

<%@ Page Language="VB"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      Name:<br/>
      <asp:textbox id="NameTextBox"
        runat="server"/>
        
      <asp:requiredfieldvalidator id="NameTextBoxRequiredValidator"
        controltovalidate="NameTextBox"
        errormessage="Name field."
        text="Please enter your name"
        runat="server"/>     
        
      <br/>  
      
      City:<br/>
      <asp:textbox id="CityTextBox"
        runat="server"/>
        
      <asp:requiredfieldvalidator id="CityTextBoxRequiredValidator"
        controltovalidate="CityTextBox"
        errormessage="City field."
        text="Please enter the city."
        runat="server"/> 
        
      <br/>
      
      <asp:Button id="SubmitButton"
        text="Submit"
        runat="server"/>
      
      <hr/>
      
      <asp:ValidationSummary 
        id="valSum" 
        displaymode="BulletList" 
        headertext="You must enter a value in the following fields:"
        runat="server"/>
    
    </form>
  </body>
</html>
 
<%@ Page Language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      Name:<br/>
      <asp:textbox id="NameTextBox"
        runat="server"/>
        
      <asp:requiredfieldvalidator id="NameTextBoxRequiredValidator"
        controltovalidate="NameTextBox"
        errormessage="Name field."
        text="Please enter your name"
        runat="server"/>     
        
      <br/>  
      
      City:<br/>
      <asp:textbox id="CityTextBox"
        runat="server"/>
        
      <asp:requiredfieldvalidator id="CityTextBoxRequiredValidator"
        controltovalidate="CityTextBox"
        errormessage="City field."
        text="Please enter the city."
        runat="server"/> 
        
      <br/>
      
      <asp:Button id="SubmitButton"
        text="Submit"
        runat="server"/>
      
      <hr/>
      
      <asp:ValidationSummary 
        id="valSum" 
        displaymode="BulletList" 
        headertext="You must enter a value in the following fields:"
        runat="server"/>
    
    </form>
  </body>
</html>
 

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

ValidationSummary クラス
ValidationSummary メンバ
System.Web.UI.WebControls 名前空間
ValidationSummaryDisplayMode