FormView.EmptyDataTemplate プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > FormView.EmptyDataTemplate プロパティの意味・解説 

FormView.EmptyDataTemplate プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

レコード格納されていないデータ ソースに FormView コントロールバインドされている場合表示される空のデータ行に、ユーザー定義のコンテンツ取得または設定します

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

<TemplateContainerAttribute(GetType(FormView))> _
Public Overridable Property
 EmptyDataTemplate As ITemplate
Dim instance As FormView
Dim value As ITemplate

value = instance.EmptyDataTemplate

instance.EmptyDataTemplate = value
[TemplateContainerAttribute(typeof(FormView))] 
public virtual ITemplate EmptyDataTemplate { get;
 set; }
[TemplateContainerAttribute(typeof(FormView))] 
public:
virtual property ITemplate^ EmptyDataTemplate {
    ITemplate^ get ();
    void set (ITemplate^ value);
}
/** @property */
public ITemplate get_EmptyDataTemplate ()

/** @property */
public void set_EmptyDataTemplate (ITemplate
 value)
public function get EmptyDataTemplate
 () : ITemplate

public function set EmptyDataTemplate
 (value : ITemplate)

プロパティ
空のデータ行用のカスタム コンテンツ含んだ System.Web.UI.ITemplate。既定値null 参照 (Visual Basic では Nothing) で、このプロパティ設定されていないことを示します

解説解説
使用例使用例

レコード格納されていないデータ ソースFormView コントロールバインドされている場合表示される、空のデータ行のカスタム スタイル指定する方法次の例に示します

<%@ Page language="VB" %>

<html>
  <body>
    <form runat="server">
        
      <h3>FormView EmptyDataTemplate Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID" 
        runat="server">
        
        <EmptyDataRowStyle BackColor="Red"
          height="100"/> 
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>'
 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName")
 %>&nbsp;<%# Eval("LastName") %></h3>
      
                <%# Eval("Title") %>       
 
              </td>
            </tr>
          </table>
        
        </itemtemplate>
          
        <emptydatatemplate>
          <table>
            <tr>
              <td>
                <asp:image id="NoDataImage"
                  imageurl="~/Images/NoDataImage.jpg"
 
                  runat="server"/>
              </td>
              <td>
                No records available.
              </td>
            </tr>
          </table>
        </emptydatatemplate>
          
        <pagersettings position="Bottom"
          mode="NextPrevious"/> 
                  
      </asp:formview>
          
      <!-- This example uses Microsoft SQL Server and connects
  -->
      <!-- to the Northwind sample database. Use an ASP.NET
     -->
      <!-- expression to retrieve the connection string
 value   -->
      <!-- from the Web.config file.                            -->
      
      <!-- The select query for the following
 SqlDataSource     -->
      <!-- control is intentionally set
 to return no results    -->
      <!-- to demonstrate the empty data row.             
      --> 
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName],
 [Title], [PhotoPath] From [Employees] Where [EmployeeID]=1000"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
            
    </form>
  </body>
</html>

<%@ Page language="C#" %>

<html>
  <body>
    <form runat="server">
        
      <h3>FormView EmptyDataTemplate Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID" 
        runat="server">
        
        <EmptyDataRowStyle BackColor="Red"
          height="100"/> 
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %>&nbsp;<%#
 Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate>
          
        <emptydatatemplate>
          <table>
            <tr>
              <td>
                <asp:image id="NoDataImage"
                  imageurl="~/Images/NoDataImage.jpg" 
                  runat="server"/>
              </td>
              <td>
                No records available.
              </td>
            </tr>
          </table>
        </emptydatatemplate>
          
        <pagersettings position="Bottom"
          mode="NextPrevious"/> 
                  
      </asp:formview>
          
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value
   -->
      <!-- from the Web.config file.                            -->
      
      <!-- The select query for the following SqlDataSource
     -->
      <!-- control is intentionally set to return
 no results    -->
      <!-- to demonstrate the empty data row.                   --> 
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title],
 [PhotoPath] From [Employees] Where [EmployeeID]=1000"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
            
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FormView クラス
FormView メンバ
System.Web.UI.WebControls 名前空間
System.Web.UI.ITemplate
FormView.EmptyDataRowStyle プロパティ
EmptyDataText
FormView.EditItemTemplate プロパティ
FormView.EmptyDataTemplate プロパティ
HeaderTemplate
InsertItemTemplate
ItemTemplate
PagerTemplate


このページでは「.NET Framework クラス ライブラリ リファレンス」からFormView.EmptyDataTemplate プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からFormView.EmptyDataTemplate プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からFormView.EmptyDataTemplate プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「FormView.EmptyDataTemplate プロパティ」の関連用語

FormView.EmptyDataTemplate プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



FormView.EmptyDataTemplate プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS