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

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

DataList.FooterTemplate プロパティ

DataList コントロールフッター セクションテンプレート取得または設定します

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

<TemplateContainerAttribute(GetType(DataListItem))> _
Public Overridable Property
 FooterTemplate As ITemplate
Dim instance As DataList
Dim value As ITemplate

value = instance.FooterTemplate

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

/** @property */
public void set_FooterTemplate (ITemplate value)
public function get FooterTemplate
 () : ITemplate

public function set FooterTemplate
 (value : ITemplate)

プロパティ
DataList コントロールフッター セクションテンプレート格納している System.Web.UI.ITemplate オブジェクト既定値null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

FooterTemplate プロパティ使用してDataList コントロールフッター セクション内容制御する方法コード例次に示します

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。このコード サンプルは、拡張子.aspx の空のテキスト ファイルコピーする必要がありますWeb フォームコード モデル詳細については、「ASP.NET Web ページコード モデル」を参照してください

<%@ Page Language="VB" AutoEventWireup="True"
 %>
<%@ Import Namespace="System.Data"
 %>
 
<html>
   <script runat="server">
 
      Function CreateDataSource() As ICollection
 
      
         ' Create sample data for the DataList control.
         Dim dt As DataTable = New
 DataTable()
         dim dr As DataRow
 
         ' Define the columns of the table.
         dt.Columns.Add(New DataColumn("IntegerValue",
 GetType(Int32)))
         dt.Columns.Add(New DataColumn("StringValue",
 GetType(String)))
         dt.Columns.Add(New DataColumn("CurrencyValue",
 GetType(Double)))
         dt.Columns.Add(New DataColumn("ImageValue",
 GetType(String)))
 
         ' Populate the table with sample values.
         Dim i As Integer

         For i = 0 To 8 

            dr = dt.NewRow()
 
            dr(0) = i
            dr(1) = "Description for item " &
 i.ToString()
            dr(2) = 1.23 * (i + 1)
            dr(3) = "Image" & i.ToString() &
 ".jpg"
 
            dt.Rows.Add(dr)

         Next i
 
         Dim dv As DataView = New
 DataView(dt)
         Return dv

      End Function
 
      Sub Page_Load(sender As Object,
 e As EventArgs) 

         ' Load sample data only once, when the page is first loaded.
         If Not IsPostBack Then
 
     
            ItemsList.DataSource = CreateDataSource()
            ItemsList.DataBind()
         
         End If

      End Sub

      Sub Selection_Change(sender As Object,
 e As EventArgs)

         ' Set the background color for the heading and footer sections
         ' of the DataList control.
         ItemsList.HeaderStyle.BackColor = _
             System.Drawing.Color.FromName(List.SelectedItem.Value)
         ItemsList.FooterStyle.BackColor = _
             System.Drawing.Color.FromName(List.SelectedItem.Value)

      End Sub
 
   </script>
 
<body>
 
   <form runat=server>

      <h3>DataList HeaderStyle and FooterStyle Example</h3>

      Select a background color for the header
 and footer sections.

      <br><br>
 
      <asp:DataList id="ItemsList"
           BorderColor="black"
           CellPadding="5"
           CellSpacing="5"
           RepeatDirection="Vertical"
           RepeatLayout="Table"
           RepeatColumns="3"
           ShowBorder="True"
           ShowFooter="True"
           runat="server">

         <HeaderStyle BackColor="White">
         </HeaderStyle>

         <FooterStyle BackColor="White">
         </FooterStyle>

         <AlternatingItemStyle BackColor="Gainsboro">
         </AlternatingItemStyle>

         <HeaderTemplate>

            List of items

         </HeaderTemplate>

         <FooterTemplate>

            <asp:Image id="FooterImage"
                 ImageUrl='FooterImage.jpg'
                 runat="server"/>

         </FooterTemplate>
               
         <ItemTemplate>

            Description: <br>
            <%# DataBinder.Eval(Container.DataItem, "StringValue")
 %>

            <br>

            Price: <%# DataBinder.Eval(Container.DataItem, "CurrencyValue",
 "{0:c}") %>

            <br>

            <asp:Image id="ProductImage"
                 ImageUrl='<%# DataBinder.Eval(Container.DataItem,
 "ImageValue") %>'
                 runat="server"/>

         </ItemTemplate>
 
      </asp:DataList>

      <hr>

      Header and footer BackColor: <br> 

      <asp:DropDownList id="List"
           AutoPostBack="True"
           OnSelectedIndexChanged="Selection_Change"
           runat="server">

         <asp:ListItem Selected="True" Value="White">
 White </asp:ListItem>
         <asp:ListItem Value="Silver"> Silver
 </asp:ListItem>
         <asp:ListItem Value="DarkGray"> Dark
 Gray </asp:ListItem>
         <asp:ListItem Value="Khaki"> Khaki
 </asp:ListItem>
         <asp:ListItem Value="DarkKhaki"> Dark
 Khaki </asp:ListItem>

      </asp:DropDownList>
 
   </form>
 
</body>
</html>

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<html>
   <script runat="server">
 
      ICollection CreateDataSource() 
      {
      
         // Create sample data for the DataList control.
         DataTable dt = new DataTable();
         DataRow dr;
 
         // Define the columns of the table.
         dt.Columns.Add(new DataColumn("IntegerValue",
 typeof(Int32)));
         dt.Columns.Add(new DataColumn("StringValue",
 typeof(String)));
         dt.Columns.Add(new DataColumn("CurrencyValue",
 typeof(double)));
         dt.Columns.Add(new DataColumn("ImageValue",
 typeof(String)));
 
         // Populate the table with sample values.
         for (int i = 0; i < 9; i++) 
         {
            dr = dt.NewRow();
 
            dr[0] = i;
            dr[1] = "Description for item " + i.ToString();
            dr[2] = 1.23 * (i + 1);
            dr[3] = "Image" + i.ToString() + ".jpg";
 
            dt.Rows.Add(dr);
         }
 
         DataView dv = new DataView(dt);
         return dv;
      }
  
      void Page_Load(Object sender, EventArgs e) 
      {

         // Load sample data only once, when the page is first loaded.
         if (!IsPostBack) 
         {
            ItemsList.DataSource = CreateDataSource();
            ItemsList.DataBind();
         }

      }

      void Selection_Change(Object sender, EventArgs e)
      {

         // Set the background color for the heading and footer sections
         // of the DataList control.
         ItemsList.HeaderStyle.BackColor = 
             System.Drawing.Color.FromName(List.SelectedItem.Value);
         ItemsList.FooterStyle.BackColor = 
             System.Drawing.Color.FromName(List.SelectedItem.Value);

      }
 
   </script>
 
<body>
 
   <form runat=server>

      <h3>DataList HeaderStyle and FooterStyle Example</h3>

      Select a background color for the header and footer sections.

      <br><br>
 
      <asp:DataList id="ItemsList"
           BorderColor="black"
           CellPadding="5"
           CellSpacing="5"
           RepeatDirection="Vertical"
           RepeatLayout="Table"
           RepeatColumns="3"
           ShowBorder="True"
           ShowFooter="True"
           runat="server">

         <HeaderStyle BackColor="White">
         </HeaderStyle>

         <FooterStyle BackColor="White">
         </FooterStyle>

         <AlternatingItemStyle BackColor="Gainsboro">
         </AlternatingItemStyle>

         <HeaderTemplate>

            List of items

         </HeaderTemplate>

         <FooterTemplate>

            <asp:Image id="FooterImage"
                 ImageUrl='FooterImage.jpg'
                 runat="server"/>

         </FooterTemplate>
               
         <ItemTemplate>

            Description: <br>
            <%# DataBinder.Eval(Container.DataItem, "StringValue") %>

            <br>

            Price: <%# DataBinder.Eval(Container.DataItem, "CurrencyValue",
 "{0:c}") %>

            <br>

            <asp:Image id="ProductImage"
                 ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageValue")
 %>'
                 runat="server"/>

         </ItemTemplate>
 
      </asp:DataList>

      <hr>

      Header and footer BackColor: <br> 

      <asp:DropDownList id="List"
           AutoPostBack="True"
           OnSelectedIndexChanged="Selection_Change"
           runat="server">

         <asp:ListItem Selected="True" Value="White"> White
 </asp:ListItem>
         <asp:ListItem Value="Silver"> Silver </asp:ListItem>
         <asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
         <asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
         <asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>

      </asp:DropDownList>
 
   </form>
 
</body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「DataList.FooterTemplate プロパティ」の関連用語


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

   

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



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

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

©2025 GRAS Group, Inc.RSS