DataGrid クラス

定義

テーブルのデータ ソースから取得した項目を表示するデータ連結リスト コントロール。 DataGrid コントロールではこれらの項目の選択、並べ替え、および編集を行えます。

public ref class DataGrid : System::Web::UI::WebControls::BaseDataList, System::Web::UI::INamingContainer
public class DataGrid : System.Web.UI.WebControls.BaseDataList, System.Web.UI.INamingContainer
type DataGrid = class
    inherit BaseDataList
    interface INamingContainer
Public Class DataGrid
Inherits BaseDataList
Implements INamingContainer
継承
実装

次のコード例では、 コントロールを使用 DataGrid してデータ ソース内の項目を表示する方法を示します。

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script language="C#" runat="server">
 
      ICollection CreateDataSource() 
      {
         DataTable dt = new DataTable();
         DataRow dr;
 
         dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
         dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
         dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
 
         for (int i = 0; i < 9; i++) 
         {
            dr = dt.NewRow();
 
            dr[0] = i;
            dr[1] = "Item " + i.ToString();
            dr[2] = 1.23 * (i + 1);
 
            dt.Rows.Add(dr);
         }
 
         DataView dv = new DataView(dt);
         return dv;
      }
 
      void Page_Load(Object sender, EventArgs e) 
      {
 
         if (!IsPostBack) 
         {
            // Load this data only once.
            ItemsGrid.DataSource= CreateDataSource();
            ItemsGrid.DataBind();
         }
      }
 
   </script>
 
<head runat="server">
    <title>DataGrid Example</title>
</head>
<body>
 
   <form id="form1" runat="server">
 
      <h3>DataGrid Example</h3>
 
      <b>Product List</b>
 
      <asp:DataGrid id="ItemsGrid"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           AutoGenerateColumns="true"
           runat="server">

         <HeaderStyle BackColor="#00aaaa">
         </HeaderStyle> 
 
      </asp:DataGrid>
 
   </form>
 
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script language="VB" runat="server">
     Function CreateDataSource() As ICollection
        Dim dt As New DataTable()
        Dim dr As DataRow
        
        dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
        dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
        dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))
        
        Dim i As Integer
        For i = 0 To 8
            dr = dt.NewRow()
            
            dr(0) = i
            dr(1) = "Item " + i.ToString()
            dr(2) = 1.23 *(i + 1)
            
            dt.Rows.Add(dr)
        Next i
        
        Dim dv As New DataView(dt)
        Return dv
    End Function 'CreateDataSource


    Sub Page_Load(sender As Object, e As EventArgs)
        
        If Not IsPostBack Then
            ' Load this data only once.
            ItemsGrid.DataSource = CreateDataSource()
            ItemsGrid.DataBind()
        End If
    End Sub 'Page_Load
 
  </script>
 
<head runat="server">
    <title>DataGrid Example</title>
</head>
<body>
 
   <form id="form1" runat="server">
 
      <h3>DataGrid Example</h3>
 
      <b>Product List</b>
 
      <asp:DataGrid id="ItemsGrid"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           AutoGenerateColumns="true"
           runat="server">

         <HeaderStyle BackColor="#00aaaa">
         </HeaderStyle> 
 
      </asp:DataGrid>
 
   </form>
 
</body>
</html>

次のコード例は、単純なショッピング カートにコントロールを DataGrid 使用する方法を示しています。

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script language="C#" runat="server">
 
      DataTable Cart;
      DataView CartView;
 
      ICollection CreateDataSource() 
      {
         DataTable dt = new DataTable();
         DataRow dr;
 
         dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
         dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
         dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
 
         for (int i = 0; i < 9; i++) 
         {
            dr = dt.NewRow();
 
            dr[0] = i;
            dr[1] = "Item " + i.ToString();
            dr[2] = 1.23 * (i + 1);
 
            dt.Rows.Add(dr);
         }
 
         DataView dv = new DataView(dt);
         return dv;
      }
 
      void Page_Load(Object sender, EventArgs e) 
      {
     
         if (Session["DG4_ShoppingCart"] == null) 
         {
            Cart = new DataTable();
            Cart.Columns.Add(new DataColumn("Item", typeof(string)));
            Cart.Columns.Add(new DataColumn("Price", typeof(string)));
            Session["DG4_ShoppingCart"] = Cart;
         }

         else 
         {
            Cart = (DataTable)Session["DG4_ShoppingCart"];
         }    

         CartView = new DataView(Cart);
         ShoppingCart.DataSource = CartView;
         ShoppingCart.DataBind();
 
         if (!IsPostBack) 
         {
            // Load this data only once.
            ItemsGrid.DataSource= CreateDataSource();
            ItemsGrid.DataBind();
         }
      }
 
      void Grid_CartCommand(Object sender, DataGridCommandEventArgs e) 
      {
     
         DataRow dr = Cart.NewRow();
         
         // e.Item is the table row where the command is raised.
         // For bound columns, the value is stored in the Text property of the TableCell.
         TableCell itemCell = e.Item.Cells[2];
         TableCell priceCell = e.Item.Cells[3];
         string item = itemCell.Text;
         string price = priceCell.Text;
          
         if (((Button)e.CommandSource).CommandName == "AddToCart") 
         {
            dr[0] = item;
            dr[1] = price;
            Cart.Rows.Add(dr);
         }

         else 
         {  

            // Remove from Cart.
         
            CartView.RowFilter = "Item='" + item + "'";
            if (CartView.Count > 0) 
            {     
               CartView.Delete(0);
            }
            CartView.RowFilter = "";
         }

         ShoppingCart.DataBind();
 
      }
 
 
   </script>
 
<head runat="server">
    <title>DataGrid Example</title>
</head>
<body>
 
   <form id="form1" runat="server">
 
   <h3>DataGrid Example</h3>
 
   <table cellpadding="5">
      <tr valign="top">
         <td>
 
            <b>Product List</b>
 
            <asp:DataGrid id="ItemsGrid"
                 BorderColor="black"
                 BorderWidth="1"
                 CellPadding="3"
                 AutoGenerateColumns="false"
                 OnItemCommand="Grid_CartCommand"
                 runat="server">

               <HeaderStyle BackColor="#00aaaa">
               </HeaderStyle>
 
               <Columns>
 
                  <asp:ButtonColumn 
                       HeaderText="Add to cart" 
                       ButtonType="PushButton" 
                       Text="Add" 
                       CommandName="AddToCart" />
 
                  <asp:ButtonColumn 
                       HeaderText="Remove from cart" 
                       ButtonType="PushButton" 
                       Text="Remove" 
                       CommandName="RemoveFromCart" />
 
                  <asp:BoundColumn 
                       HeaderText="Item" 
                       DataField="StringValue"/>

                  <asp:BoundColumn 
                       HeaderText="Price" 
                       DataField="CurrencyValue" 
                       DataFormatString="{0:c}">

                     <ItemStyle HorizontalAlign="right">
                     </ItemStyle>

                  </asp:BoundColumn>   
 
               </Columns>
 
            </asp:DataGrid>
 
         </td>
         <td>
 
            <b>Shopping Cart</b>
 
            <asp:DataGrid id="ShoppingCart" 
                 runat="server"
                 BorderColor="black"
                 BorderWidth="1"
                 GridLines="Both"
                 ShowFooter="false"
                 CellPadding="3"
                 CellSpacing="0">

               <HeaderStyle BackColor="#00aaaa">
               </HeaderStyle>

            </asp:DataGrid> 
 
         </td>
      </tr>
 
   </table>
 
   </form>
 
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script language="VB" runat="server">
 
      Dim Cart As DataTable
      Dim CartView As DataView
      
        Function CreateDataSource() As ICollection
            Dim dt As New DataTable()
            Dim dr As DataRow
            
            dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
            dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
            dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))
            
            Dim i As Integer
            For i = 0 To 8
                dr = dt.NewRow()
                
                dr(0) = i
                dr(1) = "Item " + i.ToString()
                dr(2) = 1.23 *(i + 1)
                
                dt.Rows.Add(dr)
            Next i
            
            Dim dv As New DataView(dt)
            Return dv
        End Function 'CreateDataSource


        Sub Page_Load(sender As Object, e As EventArgs)
            
            If Session("DG4_ShoppingCart") Is Nothing Then
                Cart = New DataTable()
                Cart.Columns.Add(New DataColumn("Item", GetType(String)))
                Cart.Columns.Add(New DataColumn("Price", GetType(String)))
                Session("DG4_ShoppingCart") = Cart
            
            Else
                Cart = CType(Session("DG4_ShoppingCart"), DataTable)
            End If
            
            CartView = New DataView(Cart)
            ShoppingCart.DataSource = CartView
            ShoppingCart.DataBind()
            
            If Not IsPostBack Then
                ' Load this data only once.
                ItemsGrid.DataSource = CreateDataSource()
                ItemsGrid.DataBind()
            End If
        End Sub 'Page_Load


        Sub Grid_CartCommand(sender As Object, e As DataGridCommandEventArgs)
            
            Dim dr As DataRow = Cart.NewRow()
            
            ' e.Item is the table row where the command is raised.
            ' For bound columns, the value is stored in the Text property of the TableCell.
            Dim itemCell As TableCell = e.Item.Cells(2)
            Dim priceCell As TableCell = e.Item.Cells(3)
            Dim item As String = itemCell.Text
            Dim price As String = priceCell.Text
            
            If CType(e.CommandSource, Button).CommandName = "AddToCart" Then
                dr(0) = item
                dr(1) = price
                Cart.Rows.Add(dr)
            
            Else 

                'Remove from Cart.
                CartView.RowFilter = "Item" + ChrW(61) + "'" + item + "'"
                If CartView.Count > 0 Then
                    CartView.Delete(0)
                End If
                CartView.RowFilter = ""
            End If
            
            ShoppingCart.DataBind()
        End Sub 'Grid_CartCommand 
   </script>
 
<head runat="server">
    <title>DataGrid Example</title>
</head>
<body>
 
   <form id="form1" runat="server">
 
   <h3>DataGrid Example</h3>
 
   <table cellpadding="5">
      <tr valign="top">
         <td>
 
            <b>Product List</b>
 
            <asp:DataGrid id="ItemsGrid"
                 BorderColor="black"
                 BorderWidth="1"
                 CellPadding="3"
                 AutoGenerateColumns="false"
                 OnItemCommand="Grid_CartCommand"
                 runat="server">

               <HeaderStyle BackColor="#00aaaa">
               </HeaderStyle>
 
               <Columns>
 
                  <asp:ButtonColumn 
                       HeaderText="Add to cart" 
                       ButtonType="PushButton" 
                       Text="Add" 
                       CommandName="AddToCart" />
 
                  <asp:ButtonColumn 
                       HeaderText="Remove from cart" 
                       ButtonType="PushButton" 
                       Text="Remove" 
                       CommandName="RemoveFromCart" />
 
                  <asp:BoundColumn 
                       HeaderText="Item" 
                       DataField="StringValue"/>

                  <asp:BoundColumn 
                       HeaderText="Price" 
                       DataField="CurrencyValue" 
                       DataFormatString="{0:c}">

                     <ItemStyle HorizontalAlign="right">
                     </ItemStyle>

                  </asp:BoundColumn>   
 
               </Columns>
 
            </asp:DataGrid>
 
         </td>
         <td>
 
            <b>Shopping Cart</b>
 
            <asp:DataGrid id="ShoppingCart" 
                 runat="server"
                 BorderColor="black"
                 BorderWidth="1"
                 GridLines="Both"
                 ShowFooter="false"
                 CellPadding="3"
                 CellSpacing="0">

               <HeaderStyle BackColor="#00aaaa">
               </HeaderStyle>

            </asp:DataGrid> 
 
         </td>
      </tr>
 
   </table>
 
   </form>
 
</body>
</html>

次のコード例では、 コントロールによって生成された タグと <tr> タグに属性を<td>動的に追加する方法をDataGrid示します。


<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
<script runat="server">
 
   ICollection CreateDataSource() 
   {
      DataTable dt = new DataTable();
      DataRow dr;
 
      dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
      dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
      dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
 
      for (int i = 0; i < 5; i++) 
      {
         dr = dt.NewRow();
 
         dr[0] = i;
         dr[1] = "Item " + i.ToString();
         dr[2] = 1.23 * (i+1);
 
         dt.Rows.Add(dr);
      }
 
      DataView dv = new DataView(dt);
      return dv;
   }
 
   void Page_Load(Object sender, EventArgs e) 
   {
 
      if (!IsPostBack) 
      {
         // Load this data only once.
         ItemsGrid.DataSource = CreateDataSource();
         ItemsGrid.DataBind();
      }
 
   }
 
   void Item_Bound(Object sender, DataGridItemEventArgs e) 
   {

      ListItemType itemType = (ListItemType)e.Item.ItemType;

      if ((itemType != ListItemType.Header) &&
          (itemType != ListItemType.Footer) &&
          (itemType != ListItemType.Separator))
      {

         // Get the IntegerValue cell from the grid's column collection.
         TableCell intCell = (TableCell)e.Item.Controls[0];

         // Add attributes to the cell.
         intCell.Attributes.Add("id", "intCell" + e.Item.ItemIndex.ToString());
         intCell.Attributes.Add("OnClick", 
                                "Update_intCell" + 
                                e.Item.ItemIndex.ToString() + 
                                "()");

         // Add attributes to the row.
         e.Item.Attributes.Add("id", "row" + e.Item.ItemIndex.ToString());
         e.Item.Attributes.Add("OnDblClick", 
                                "Update_row" + 
                                e.Item.ItemIndex.ToString() + 
                                "()");
         
      }
 
   }
 
</script>

<script type="text/vbscript">

   sub Update_intCell0 
      Alert "You Selected Cell 0."
   end sub

   sub Update_intCell1 
      Alert "You Selected Cell 1."
   end sub

   sub Update_intCell2 
      Alert "You Selected Cell 2."
   end sub

   sub Update_intCell3 
      Alert "You Selected Cell 3."
   end sub

   sub Update_intCell4 
      Alert "You Selected Cell 4."
   end sub

   sub UpDate_row0 
      Alert "You selected the row 0."
   end sub

   sub UpDate_row1 
      Alert "You selected the row 1."
   end sub

   sub UpDate_row2 
      Alert "You selected the row 2."
   end sub

   sub UpDate_row3 
      Alert "You selected the row 3."
   end sub

   sub UpDate_row4 
      Alert "You selected the row 4."
   end sub   

</script>
 
<head runat="server">
    <title>
            Adding Attributes to the <td> and <tr> </title>
</head>
<body>
 
   <form id="form1" runat="server">

      <h3>
            Adding Attributes to the <td> and <tr> <br />
            Tags of a DataGrid Control
      </h3>
 
      <asp:DataGrid id="ItemsGrid" runat="server"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           ShowFooter="true"
           OnItemDataBound="Item_Bound"
           AutoGenerateColumns="false">

         <HeaderStyle BackColor="#00aaaa">
         </HeaderStyle>

         <FooterStyle BackColor="#00aaaa">
         </FooterStyle>

         <Columns>

            <asp:BoundColumn HeaderText="Number" 
                 DataField="IntegerValue">

               <ItemStyle BackColor="yellow">
               </ItemStyle>
 
            </asp:BoundColumn>

            <asp:BoundColumn
                 HeaderText="Item" 
                 DataField="StringValue"/>

            <asp:BoundColumn 
                 HeaderText="Price" 
                 DataField="CurrencyValue" 
                 DataFormatString="{0:c}">

               <ItemStyle HorizontalAlign="right">
               </ItemStyle>
   
            </asp:BoundColumn>

         </Columns>
   
      </asp:DataGrid>

      <br /><br />

      Click on one of the cells in the <b>Number</b> column to select the cell.

      <br /><br />

      Double click on a row to select a row.   
 
   </form>
 
</body>
</html>

<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
<script runat="server">
 
   Function CreateDataSource() As ICollection 
   
      Dim dt As DataTable = New DataTable()
      Dim dr As DataRow
      Dim i As Integer
      Dim dv As DataView
 
      dt.Columns.Add(New DataColumn("IntegerValue", GetType(Integer)))
      dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
      dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))
 
      For i = 0 to 4 

         dr = dt.NewRow()
 
         dr(0) = i
         dr(1) = "Item " + i.ToString()
         dr(2) = 1.23 * (i+1)
 
         dt.Rows.Add(dr)
      
      Next i
 
      dv = New DataView(dt)
      CreateDataSource = dv
   
   End Function
 
   Sub Page_Load(sender As Object, e As EventArgs) 
 
      If Not IsPostBack 
  
         ' Load this data only once.
         ItemsGrid.DataSource = CreateDataSource()
         ItemsGrid.DataBind()
      
      End If 
 
   End Sub
 
   Sub Item_Bound(sender As Object, e As DataGridItemEventArgs) 

      Dim itemType As ListItemType 
      Dim intCell As TableCell

      itemType = CType(e.Item.ItemType, ListItemType)

      If (itemType <> ListItemType.Header) And _
         (itemType <> ListItemType.Footer) And _
         (itemType <> ListItemType.Separator) Then

         ' Get the IntegerValue cell from the grid's column collection.
         intCell = CType(e.Item.Controls(0), TableCell)

         ' Add attributes to the cell.
         intCell.Attributes.Add("id", "intCell" + e.Item.ItemIndex.ToString())
         intCell.Attributes.Add("OnClick", _
                                "Update_intCell" + _
                                e.Item.ItemIndex.ToString() + _
                                "()")
          
         ' Add attributes to the row.
         e.Item.Attributes.Add("id", "row" + e.Item.ItemIndex.ToString())
         e.Item.Attributes.Add("OnDblClick", _
                                "Update_row" + _
                                e.Item.ItemIndex.ToString() + _
                                "()")

      End If
 
   End Sub
 
</script>

<script type="text/vbscript">

   sub Update_intCell0 
      Alert "You Selected Cell 0."
   end sub

   sub Update_intCell1 
      Alert "You Selected Cell 1."
   end sub

   sub Update_intCell2 
      Alert "You Selected Cell 2."
   end sub

   sub Update_intCell3 
      Alert "You Selected Cell 3."
   end sub

   sub Update_intCell4 
      Alert "You Selected Cell 4."
   end sub

   sub UpDate_row0 
      Alert "You selected the row 0."
   end sub

   sub UpDate_row1 
      Alert "You selected the row 1."
   end sub

   sub UpDate_row2 
      Alert "You selected the row 2."
   end sub

   sub UpDate_row3 
      Alert "You selected the row 3."
   end sub

   sub UpDate_row4 
      Alert "You selected the row 4."
   end sub   

</script>
 
<head runat="server">
    <title>

            Adding Attributes to the <td> and <tr> </title>
</head>
<body>
 
   <form id="form1" runat="server">

      <h3>

            Adding Attributes to the <td> and <tr> <br />
            Tags of a DataGrid Control

      </h3>
 
      <asp:DataGrid id="ItemsGrid" runat="server"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           ShowFooter="true"
           OnItemDataBound="Item_Bound"
           AutoGenerateColumns="false">

         <HeaderStyle BackColor="#00aaaa">
         </HeaderStyle>

         <FooterStyle BackColor="#00aaaa">
         </FooterStyle>

         <Columns>

            <asp:BoundColumn HeaderText="Number" 
                 DataField="IntegerValue">

               <ItemStyle BackColor="yellow">
               </ItemStyle>
 
            </asp:BoundColumn>

            <asp:BoundColumn
                 HeaderText="Item" 
                 DataField="StringValue"/>

            <asp:BoundColumn 
                 HeaderText="Price" 
                 DataField="CurrencyValue" 
                 DataFormatString="{0:c}">

               <ItemStyle HorizontalAlign="right">
               </ItemStyle>
   
            </asp:BoundColumn>

         </Columns>
   
      </asp:DataGrid>

      <br /><br />

      Click on one of the cells in the <b>Number</b> column to select the cell.

      <br /><br />

      Double click on a row to select a row.   
 
   </form>
 
</body>
</html>

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script runat="server">
 
      ICollection CreateDataSource() 
      {
      
         // Create sample data for the DataGrid 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)));
 
         // Populate the table with sample values.
         for (int i = 0; i < 9; i++) 
         {
            dr = dt.NewRow();
 
            dr[0] = i;
            dr[1] = "Item " + i.ToString();
            dr[2] = 1.23 * (i + 1);
 
            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) 
         {
            ItemsGrid.DataSource = CreateDataSource();
            ItemsGrid.DataBind();
         }

      }

      void Button_Click(Object sender, EventArgs e) 
      {

         // Count the number of selected items in the DataGrid control.
         int count = 0;

         // Display the selected times.
         Message.Text = "You Selected: <br />";

         // Iterate through each item (row) in the DataGrid control and 
         // determine whether it is selected.
         foreach (DataGridItem item in ItemsGrid.Items)
         {

            DetermineSelection(item, ref count);        

         }

         // If no items are selected, display the appropriate message.
         if (count == 0)
         {

            Message.Text = "No items selected";

         }

      }

      void DetermineSelection(DataGridItem item, ref int count)
      {

         // Retrieve the SelectCheckBox CheckBox control from the specified 
         // item (row) in the DataGrid control.
         CheckBox selection = (CheckBox)item.FindControl("SelectCheckBox");

         // If the item is selected, display the appropriate message and 
         // increment the count of selected items.
         if (selection != null)
         {

           if (selection.Checked)
           {
              Message.Text += "- " + item.Cells[1].Text + "<br />";
              count++;
           }

         }    

      }

   </script>
 
<head runat="server">
    <title>DataGrid Example</title>
</head>
<body>
 
   <form id="form1" runat="server">
 
      <h3>DataGrid Example</h3>
 
      <b>Product List</b>
 
      <asp:DataGrid id="ItemsGrid"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           AutoGenerateColumns="False"
           runat="server">

         <HeaderStyle BackColor="#00aaaa">
         </HeaderStyle>

         <Columns>

            <asp:BoundColumn DataField="IntegerValue" 
                 HeaderText="Item"/>

            <asp:BoundColumn DataField="StringValue" 
                 HeaderText="Description"/>

            <asp:BoundColumn DataField="CurrencyValue" 
                 HeaderText="Price"
                 DataFormatString="{0:c}">

               <ItemStyle HorizontalAlign="Right">
               </ItemStyle>

            </asp:BoundColumn>

            <asp:TemplateColumn HeaderText="Select Item">

               <ItemTemplate>

                  <asp:CheckBox id="SelectCheckBox"
                       Text="Add to Cart"
                       Checked="False"
                       runat="server"/>

               </ItemTemplate>

            </asp:TemplateColumn>
 
         </Columns> 
 
      </asp:DataGrid>

      <br /><br />

      <asp:Button id="SubmitButton"
           Text="Submit"
           OnClick = "Button_Click"
           runat="server"/>

      <br /><br />

      <asp:Label id="Message"
           runat="server"/>
 
   </form>
 
</body>
</html>

<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!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" >
   <script runat="server">
 
       Function CreateDataSource() As ICollection 
      
         ' Create sample data for the DataGrid 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)))
 
         ' Populate the table with sample values.
         Dim i As Integer

         For i = 0 to 8 
        
            dr = dt.NewRow()
 
            dr(0) = i
            dr(1) = "Item " & i.ToString()
            dr(2) = 1.23 * (i + 1)
 
            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 
  
            ItemsGrid.DataSource = CreateDataSource()
            ItemsGrid.DataBind()

         End If

      End Sub

      Sub Button_Click(sender As Object, e As EventArgs) 

         ' Count the number of selected items in the DataGrid control.
         Dim count As Integer = 0

         ' Display the selected items.
         Message.Text = "You Selected: <br />"

         ' Iterate through each item (row) in the DataGrid control 
         ' and determine whether it is selected.
         Dim item As DataGridItem
 
         For Each item In ItemsGrid.Items

            DetermineSelection(item, count)        

         Next

         ' If no items are selected, display the appropriate message.
         If count = 0 Then

            Message.Text = "No items selected"

         End If

      End Sub

      Sub DetermineSelection(item As DataGridItem, ByRef count As Integer)

         ' Retrieve the SelectCheckBox CheckBox control from the specified  
         ' item (row) in the DataGrid control.
         Dim selection As CheckBox = CType(item.FindControl("SelectCheckBox"), CheckBox)

         ' If the item is selected, display the appropriate message and 
         ' increment the count of selected items.
         If Not selection Is Nothing Then

           If selection.Checked Then
           
              Message.Text &= "- " & item.Cells(1).Text & "<br />"
              count = count + 1
           
           End If

         End If    

      End Sub

   </script>
 
<head runat="server">
    <title>DataGrid Example</title>
</head>
<body>
 
   <form id="form1" runat="server">
 
      <h3>DataGrid Example</h3>
 
      <b>Product List</b>
 
      <asp:DataGrid id="ItemsGrid"
           BorderColor="black"
           BorderWidth="1"
           CellPadding="3"
           AutoGenerateColumns="False"
           runat="server">

         <HeaderStyle BackColor="#00aaaa">
         </HeaderStyle>

         <Columns>

            <asp:BoundColumn DataField="IntegerValue" 
                 HeaderText="Item"/>

            <asp:BoundColumn DataField="StringValue" 
                 HeaderText="Description"/>

            <asp:BoundColumn DataField="CurrencyValue" 
                 HeaderText="Price"
                 DataFormatString="{0:c}">

               <ItemStyle HorizontalAlign="Right">
               </ItemStyle>

            </asp:BoundColumn>

            <asp:TemplateColumn HeaderText="Select Item">

               <ItemTemplate>

                  <asp:CheckBox id="SelectCheckBox"
                       Text="Add to Cart"
                       Checked="False"
                       runat="server"/>

               </ItemTemplate>

            </asp:TemplateColumn>
 
         </Columns> 
 
      </asp:DataGrid>

      <br /><br />

      <asp:Button id="SubmitButton"
           Text="Submit"
           OnClick = "Button_Click"
           runat="server"/>

      <br /><br />

      <asp:Label id="Message"
           runat="server"/>
 
   </form>
 
</body>
</html>

注釈

このトピックの内容:

はじめに

コントロールを DataGrid 使用して、データ ソースのフィールドをテーブル内の列として表示します。 コントロールの各行は DataGrid 、データ ソース内のレコードを表します。 コントロールは DataGrid 、選択、編集、削除、ページング、並べ替えをサポートしています。

注意事項

このコントロールを使用すると、悪意のあるクライアント スクリプトを含む可能性があるユーザー入力を表示できます。 実行可能スクリプト、SQL ステートメント、またはその他のコードについてクライアントから送信された情報を確認してから、アプリケーションに表示します。 ASP.NET は、ユーザー入力のスクリプトと HTML をブロックする入力要求検証機能を提供します。 検証サーバー コントロールは、ユーザー入力を評価するためにも提供されます。 詳細については、「 Validation Server Control Syntax」を参照してください。

列の種類によって、コントロール内の列の動作が決まります。 次の表に、使用できるさまざまな列の種類を示します。

列の型 説明
BoundColumn データ ソース内のフィールドにバインドされた列を表示します。 フィールドの各項目がテキストとして表示されます。 これは、コントロールの既定の列の DataGrid 種類です。
ButtonColumn 列の各項目のコマンド ボタンを表示します。 これにより、 や Remove ボタンなどのAddカスタム ボタン コントロールの列を作成できます。
EditCommandColumn 列の各項目の編集コマンドを含む列を表示します。
HyperLinkColumn 列の各項目の内容をハイパーリンクとして表示します。 列の内容は、データ ソースまたは静的テキストのフィールドにバインドできます。
TemplateColumn 指定したテンプレートの後の列に各項目を表示します。 これにより、列にカスタム コントロールを指定できます。

既定では、 AutoGenerateColumns プロパティは に true設定されています。これにより、データ ソース内の BoundColumn 各フィールドのオブジェクトが作成されます。 その後、各フィールドは、各フィールドが DataGrid データ ソースに表示される順序で、コントロール内の列としてレンダリングされます。

プロパティfalseを に設定AutoGenerateColumnsし、開始タグと終了<Columns>タグの間にDataGrid含める列を一覧表示することで、コントロールに表示される列を手動で制御することもできます。 指定された列は、一覧表示されている Columns 順序でコレクションに追加されます。 これにより、コントロール内の列をプログラムで DataGrid 制御できます。

注意

コントロールに列を表示 DataGrid する順序は、列がコレクションに表示される順序によって Columns 制御されます。 コレクションを操作して列の順序を Columns プログラムで変更することはできますが、目的の表示順序で列を一覧表示する方が簡単です。

明示的に宣言された列は、自動的に生成される列と組み合わせて表示できます。 両方を使用すると、明示的に宣言された列が最初にレンダリングされ、その後に自動的に生成された列が表示されます。

注意

自動的に生成された列はコレクションに Columns 追加されません。

コントロールの DataGrid 外観は、コントロールのさまざまな部分のスタイル プロパティを設定することによってカスタマイズできます。 次の表に、さまざまなスタイル プロパティを示します。

Style プロパティ [説明]
AlternatingItemStyle コントロール内の交互の項目のスタイルを DataGrid 指定します。
EditItemStyle コントロールで編集するアイテムのスタイルを DataGrid 指定します。
FooterStyle コントロールのフッター セクションのスタイルを DataGrid 指定します。
HeaderStyle コントロールのヘッダー セクションのスタイルを DataGrid 指定します。
ItemStyle コントロール内の項目のスタイルを DataGrid 指定します。
PagerStyle コントロールのページ選択セクションのスタイルを DataGrid 指定します。
SelectedItemStyle コントロールで選択した項目のスタイルを DataGrid 指定します。

コントロールのさまざまな部分を表示または非表示にすることもできます。 次の表に、表示または非表示にするパーツを制御するプロパティの一覧を示します。

プロパティ 説明
ShowFooter コントロールのフッター セクション DataGrid を表示または非表示にします。
ShowHeader コントロールのヘッダー セクション DataGrid を表示または非表示にします。

ブラウザーでコントロールによってレンダリングされる タグと <tr> タグに属性を<td>プログラムで追加することで、コントロールの外観DataGridを制御できます。 属性は、 イベントまたは OnItemDataBound イベントのイベント ハンドラーOnItemCreatedにコードを提供することで、プログラムによって追加できます。

タグに属性を <td> 追加するには、まず、属性を TableCell 追加するコントロールのセルを DataGrid 表す オブジェクトを取得します。 Control.Controlsイベント ハンドラーにItem渡されるオブジェクトの プロパティのDataGridItemEventArgsコレクションを使用して、目的TableCellのオブジェクトを取得できます。 その後、オブジェクトの コレクションの メソッドをAttributes使用AttributeCollection.Addして、TableCellタグに属性を<td>追加できます。

タグに属性を <tr> 追加するには、まず、属性を DataGridItem 追加するコントロールの行を DataGrid 表す オブジェクトを取得します。 Itemイベント ハンドラーにDataGridItemEventArgs渡されるオブジェクトの プロパティを使用して、目的DataGridItemのオブジェクトを取得できます。 その後、オブジェクトの コレクションの メソッドをAttributes使用AttributeCollection.Addして、DataGridItemタグに属性を<tr>追加できます。

ユーザー補助

アクセシビリティ標準に準拠するマークアップを生成するようにこのコントロールを構成する方法の詳細については、「 Visual Studio のアクセシビリティ 」および「コントロールとアクセシビリティの ASP.NET と ASP.NET」を参照してください。

宣言構文

<asp:DataGrid  
    AccessKey="string"  
    AllowCustomPaging="True|False"  
    AllowPaging="True|False"  
    AllowSorting="True|False"  
    AutoGenerateColumns="True|False"  
    BackColor="color name|#dddddd"  
    BackImageUrl="uri"  
    BorderColor="color name|#dddddd"  
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|  
        Inset|Outset"  
    BorderWidth="size"  
    Caption="string"  
    CaptionAlign="NotSet|Top|Bottom|Left|Right"  
    CellPadding="integer"  
    CellSpacing="integer"  
    CssClass="string"  
    DataKeyField="string"  
    DataMember="string"  
    DataSource="string"  
    DataSourceID="string"  
    EditItemIndex="integer"  
    Enabled="True|False"  
    EnableTheming="True|False"  
    EnableViewState="True|False"  
    Font-Bold="True|False"  
    Font-Italic="True|False"  
    Font-Names="string"  
    Font-Overline="True|False"  
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|  
        Large|X-Large|XX-Large"  
    Font-Strikeout="True|False"  
    Font-Underline="True|False"  
    ForeColor="color name|#dddddd"  
    GridLines="None|Horizontal|Vertical|Both"  
    Height="size"  
    HorizontalAlign="NotSet|Left|Center|Right|Justify"  
    ID="string"  
    OnCancelCommand="CancelCommand event handler"  
    OnDataBinding="DataBinding event handler"  
    OnDeleteCommand="DeleteCommand event handler"  
    OnDisposed="Disposed event handler"  
    OnEditCommand="EditCommand event handler"  
    OnInit="Init event handler"  
    OnItemCommand="ItemCommand event handler"  
    OnItemCreated="ItemCreated event handler"  
    OnItemDataBound="ItemDataBound event handler"  
    OnLoad="Load event handler"  
    OnPageIndexChanged="PageIndexChanged event handler"  
    OnPreRender="PreRender event handler"  
    OnSelectedIndexChanged="SelectedIndexChanged event handler"  
    OnSortCommand="SortCommand event handler"  
    OnUnload="Unload event handler"  
    OnUpdateCommand="UpdateCommand event handler"  
    PageSize="integer"  
    runat="server"  
    SelectedIndex="integer"  
    ShowFooter="True|False"  
    ShowHeader="True|False"  
    SkinID="string"  
    Style="string"  
    TabIndex="integer"  
    ToolTip="string"  
    UseAccessibleHeader="True|False"  
    Visible="True|False"  
    Width="size"  
>  
        <AlternatingItemStyle />  
        <Columns>  
                <asp:BoundColumn  
                    DataField="string"  
                    DataFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    ReadOnly="True|False"  
                    SortExpression="string"  
                    Visible="True|False"  
>  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:BoundColumn>  
                <asp:ButtonColumn  
                    ButtonType="LinkButton|PushButton"  
                    CausesValidation="True|False"  
                    CommandName="string"  
                    DataTextField="string"  
                    DataTextFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    SortExpression="string"  
                    Text="string"  
                    ValidationGroup="string"  
                    Visible="True|False"  
>  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:ButtonColumn>  
                <asp:EditCommandColumn  
                    ButtonType="LinkButton|PushButton"  
                    CancelText="string"  
                    CausesValidation="True|False"  
                    EditText="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    SortExpression="string"  
                    UpdateText="string"  
                    ValidationGroup="string"  
                    Visible="True|False"  
>  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:EditCommandColumn>  
                <asp:HyperLinkColumn  
                    DataNavigateUrlField="string"  
                    DataNavigateUrlFormatString="string"  
                    DataTextField="string"  
                    DataTextFormatString="string"  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    NavigateUrl="uri"  
                    SortExpression="string"  
                    Target="string|_blank|_parent|_search|_self|_top"  
                    Text="string"  
                    Visible="True|False"  
>  
                        <FooterStyle />  
                        <HeaderStyle />  
                        <ItemStyle />  
                </asp:HyperLinkColumn>  
                <asp:TemplateColumn  
                    FooterText="string"  
                    HeaderImageUrl="uri"  
                    HeaderText="string"  
                    SortExpression="string"  
                    Visible="True|False"  
>  
                            <FooterStyle />  
                            <HeaderStyle />  
                            <ItemStyle />  
                        <EditItemTemplate>  
                            <!-- child controls -->  
                        </EditItemTemplate>  
                        <FooterTemplate>  
                            <!-- child controls -->  
                        </FooterTemplate>  
                        <HeaderTemplate>  
                            <!-- child controls -->  
                        </HeaderTemplate>  
                        <ItemTemplate>  
                            <!-- child controls -->  
                        </ItemTemplate>  
                </asp:TemplateColumn>  
        </Columns>  
        <EditItemStyle />  
        <FooterStyle />  
        <HeaderStyle />  
        <ItemStyle />  
        <PagerStyle  
            BackColor="color name|#dddddd"  
            BorderColor="color name|#dddddd"  
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|  
                Groove|Ridge|Inset|Outset"  
            BorderWidth="size"  
            CssClass="string"  
            Font-Bold="True|False"  
            Font-Italic="True|False"  
            Font-Names="string"  
            Font-Overline="True|False"  
            Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|  
                Medium|Large|X-Large|XX-Large"  
            Font-Strikeout="True|False"  
            Font-Underline="True|False"  
            ForeColor="color name|#dddddd"  
            Height="size"  
            HorizontalAlign="NotSet|Left|Center|Right|Justify"  
            Mode="NextPrev|NumericPages"  
            NextPageText="string"  
            OnDisposed="Disposed event handler"  
            PageButtonCount="integer"  
            Position="Bottom|Top|TopAndBottom"  
            PrevPageText="string"  
            VerticalAlign="NotSet|Top|Middle|Bottom"  
            Visible="True|False"  
            Width="size"  
            Wrap="True|False"  
        />  
        <SelectedItemStyle />  
</asp:DataGrid>  

コンストラクター

DataGrid()

DataGrid クラスの新しいインスタンスを初期化します。

フィールド

CancelCommandName

Cancel コマンド名を表します。 このフィールドは読み取り専用です。

DeleteCommandName

Delete コマンド名を表します。 このフィールドは読み取り専用です。

EditCommandName

Edit コマンド名を表します。 このフィールドは読み取り専用です。

NextPageCommandArgument

Next コマンド引数を表します。 このフィールドは読み取り専用です。

PageCommandName

Page コマンド名を表します。 このフィールドは読み取り専用です。

PrevPageCommandArgument

Prev コマンド引数を表します。 このフィールドは読み取り専用です。

SelectCommandName

Select コマンド名を表します。 このフィールドは読み取り専用です。

SortCommandName

Sort コマンド名を表します。 このフィールドは読み取り専用です。

UpdateCommandName

Update コマンド名を表します。 このフィールドは読み取り専用です。

プロパティ

AccessKey

Web サーバー コントロールにすばやく移動できるアクセス キーを取得または設定します。

(継承元 WebControl)
Adapter

コントロール用のブラウザー固有のアダプターを取得します。

(継承元 Control)
AllowCustomPaging

カスタム ページングを有効にするかどうかを示す値を取得または設定します。

AllowPaging

ページングが有効かどうかを示す値を取得または設定します。

AllowSorting

並べ替えが有効かどうかを示す値を取得または設定します。

AlternatingItemStyle

DataGrid コントロールの交互の項目のスタイル プロパティを取得します。

AppRelativeTemplateSourceDirectory

このコントロールが含まれている Page オブジェクトまたは UserControl オブジェクトのアプリケーション相対の仮想ディレクトリを取得または設定します。

(継承元 Control)
Attributes

コントロールのプロパティに対応しない任意の属性 (表示専用) のコレクションを取得します。

(継承元 WebControl)
AutoGenerateColumns

データ ソースの各フィールドに対して BoundColumn オブジェクトを自動的に作成して DataGrid コントロールに表示するかどうかを示す値を取得または設定します。

BackColor

Web サーバー コントロールの背景色を取得または設定します。

(継承元 WebControl)
BackImageUrl

DataGrid コントロールの背景に表示するイメージの URL を取得または設定します。

BindingContainer

このコントロールのデータ バインディングを格納しているコントロールを取得します。

(継承元 Control)
BorderColor

Web コントロールの境界線の色を取得または設定します。

(継承元 WebControl)
BorderStyle

Web サーバー コントロールの境界線スタイルを取得または設定します。

(継承元 WebControl)
BorderWidth

Web サーバー コントロールの境界線の幅を取得または設定します。

(継承元 WebControl)
Caption

コントロールの HTML キャプション要素に表示するテキストを取得または設定します。 このプロパティは、補助技術デバイスのユーザーにとって、より使いやすいコントロールを実現するための手段として用意されています。

(継承元 BaseDataList)
CaptionAlign

コントロールの HTML キャプション要素の水平位置または垂直位置を取得または設定します。 このプロパティは、補助技術デバイスのユーザーにとって、より使いやすいコントロールを実現するための手段として用意されています。

(継承元 BaseDataList)
CellPadding

セルの内容とセルの境界線との間隔を取得または設定します。

(継承元 BaseDataList)
CellSpacing

セル間の間隔を取得または設定します。

(継承元 BaseDataList)
ChildControlsCreated

サーバー コントロールの子コントロールが作成されたかどうかを示す値を取得します。

(継承元 Control)
ClientID

ASP.NET によって生成される HTML マークアップのコントロール ID を取得します。

(継承元 Control)
ClientIDMode

ClientID プロパティの値を生成するために使用されるアルゴリズムを取得または設定します。

(継承元 Control)
ClientIDSeparator

ClientID プロパティで使用される区切り記号を表す文字値を取得します。

(継承元 Control)
Columns

DataGrid コントロールの列を表すオブジェクトのコレクションを取得します。

Context

現在の Web 要求に対するサーバー コントロールに関連付けられている HttpContext オブジェクトを取得します。

(継承元 Control)
Controls

データ リスト コントロールの子コントロールのコレクションを格納している ControlCollection オブジェクトを取得します。

(継承元 BaseDataList)
ControlStyle

Web サーバー コントロールのスタイルを取得します。 このプロパティは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
ControlStyleCreated

Style オブジェクトが ControlStyle プロパティに対して作成されたかどうかを示す値を取得します。 このプロパティは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
CssClass

クライアントで Web サーバー コントロールによって表示されるカスケード スタイル シート (CSS: Cascading Style Sheet) クラスを取得または設定します。

(継承元 WebControl)
CurrentPageIndex

現在表示されているページのインデックスを取得または設定します。

DataItemContainer

名前付けコンテナーが IDataItemContainer を実装している場合、名前付けコンテナーへの参照を取得します。

(継承元 Control)
DataKeyField

DataSource プロパティで指定したデータ ソースのキー フィールドを取得または設定します。

(継承元 BaseDataList)
DataKeys

データ リスト コントロールの各レコードのキー値を格納する DataKeyCollection オブジェクトを取得します。

(継承元 BaseDataList)
DataKeysArray

データ リスト コントロールの各レコードのキー値を格納する ArrayList オブジェクトを取得します。

(継承元 BaseDataList)
DataKeysContainer

名前付けコンテナーが IDataKeysControl を実装している場合、名前付けコンテナーへの参照を取得します。

(継承元 Control)
DataMember

データ リスト コントロールに連結する複数メンバー データ ソースの特定のデータ メンバーを取得または設定します。

(継承元 BaseDataList)
DataSource

コントロール内に項目を設定するために使用する値のリストを格納しているソースを取得または設定します。

(継承元 BaseDataList)
DataSourceID

データ リスト コントロールがデータ ソースを取得するために使用する、データ ソース コントロールの ID プロパティを取得または設定します。

(継承元 BaseDataList)
DesignMode

コントロールがデザイン サーフェイスで使用されているかどうかを示す値を取得します。

(継承元 Control)
EditItemIndex

編集する DataGrid コントロールの項目のインデックスを取得または設定します。

EditItemStyle

DataGrid コントロールの編集対象として選択された項目のスタイル プロパティを取得します。

Enabled

Web サーバー コントロールを有効にするかどうかを示す値を取得または設定します。

(継承元 WebControl)
EnableTheming

テーマがこのコントロールに適用されるかどうかを示す値を取得または設定します。

(継承元 WebControl)
EnableViewState

要求元クライアントに対して、サーバー コントロールがそのビュー状態と、そこに含まれる任意の子のコントロールのビュー状態を保持するかどうかを示す値を取得または設定します。

(継承元 Control)
Events

コントロールのイベント ハンドラー デリゲートのリストを取得します。 このプロパティは読み取り専用です。

(継承元 Control)
Font

Web サーバー コントロールに関連付けられたフォント プロパティを取得します。

(継承元 WebControl)
FooterStyle

DataGrid コントロールのフッター セクションのスタイル プロパティを取得します。

ForeColor

Web サーバー コントロールの前景色 (通常はテキストの色) を取得または設定します。

(継承元 WebControl)
GridLines

データ リスト コントロールのセル間に境界線を表示するかどうかを指定する値を取得または設定します。

(継承元 BaseDataList)
HasAttributes

コントロールに属性セットがあるかどうかを示す値を取得します。

(継承元 WebControl)
HasChildViewState

現在のサーバー コントロールの子コントロールが、保存されたビューステートの設定を持っているかどうかを示す値を取得します。

(継承元 Control)
HeaderStyle

DataGrid コントロールの見出しセクションのスタイル プロパティを取得します。

Height

Web サーバー コントロールの高さを取得または設定します。

(継承元 WebControl)
HorizontalAlign

コンテナー内のデータ リスト コントロールの水平方向の配置を取得または設定します。

(継承元 BaseDataList)
ID

サーバー コントロールに割り当てられたプログラム ID を取得または設定します。

(継承元 Control)
IdSeparator

コントロール ID を区別するために使用する文字を取得します。

(継承元 Control)
Initialized

コントロールが初期化されているかどうか示す値を取得します。

(継承元 BaseDataList)
IsBoundUsingDataSourceID

DataSourceID プロパティが設定されているかどうかを示す値を取得します。

(継承元 BaseDataList)
IsChildControlStateCleared

このコントロールに含まれているコントロールに、コントロールの状態が設定されているかどうかを示す値を取得します。

(継承元 Control)
IsEnabled

コントロールが有効かどうかを示す値を取得します。

(継承元 WebControl)
IsTrackingViewState

サーバー コントロールがビューステートの変更を保存しているかどうかを示す値を取得します。

(継承元 Control)
IsViewStateEnabled

このコントロールでビューステートが有効かどうかを示す値を取得します。

(継承元 Control)
Items

DataGridItem コントロールの個別の項目を表す DataGrid オブジェクトのコレクションを取得します。

ItemStyle

DataGrid コントロールの項目のスタイル プロパティを取得します。

LoadViewStateByID

コントロールがインデックスではなく ID によりビューステートの読み込みを行うかどうかを示す値を取得します。

(継承元 Control)
NamingContainer

同じ ID プロパティ値を持つ複数のサーバー コントロールを区別するための一意の名前空間を作成する、サーバー コントロールの名前付けコンテナーへの参照を取得します。

(継承元 Control)
Page

サーバー コントロールを含んでいる Page インスタンスへの参照を取得します。

(継承元 Control)
PageCount

DataGrid コントロールの項目の表示に必要なページの合計数を取得します。

PagerStyle

DataGrid コントロールのページング セクションのスタイル プロパティを取得します。

PageSize

DataGrid コントロールの 1 ページに表示される項目数を取得または設定します。

Parent

ページ コントロールの階層構造における、サーバー コントロールの親コントロールへの参照を取得します。

(継承元 Control)
RenderingCompatibility

レンダリングされる HTML と互換性がある ASP.NET のバージョンを表す値を取得します。

(継承元 Control)
RequiresDataBinding

データ リスト コントロールを指定したデータ ソースにバインドする必要があるかどうか示す値を取得または設定します。

(継承元 BaseDataList)
SelectArguments

データ バインド コントロールが、データ ソース コントロールからデータを取得するときに使用する DataSourceSelectArguments オブジェクトを取得します。

(継承元 BaseDataList)
SelectedIndex

DataGrid コントロール内の選択された項目のインデックスを取得または設定します。

SelectedItem

DataGridItem コントロールの選択された項目を表す DataGrid オブジェクトを取得します。

SelectedItemStyle

DataGrid コントロールの現在選択されている項目のスタイル プロパティを取得します。

ShowFooter

DataGrid コントロールにフッターを表示するかどうかを示す値を取得または設定します。

ShowHeader

DataGrid コントロールにヘッダーを表示するかどうかを示す値を取得または設定します。

Site

デザイン サーフェイスに現在のコントロールを表示するときに、このコントロールをホストするコンテナーに関する情報を取得します。

(継承元 Control)
SkinID

コントロールに適用するスキンを取得または設定します。

(継承元 WebControl)
Style

Web サーバー コントロールの外側のタグにスタイル属性として表示されるテキスト属性のコレクションを取得します。

(継承元 WebControl)
SupportsDisabledAttribute

コントロールの disabled プロパティが IsEnabled の場合、レンダリングされた HTML 要素の false 属性を "無効" に設定するかどうかを示す値を取得します。

(継承元 BaseDataList)
TabIndex

Web サーバー コントロールのタブ インデックスを取得または設定します。

(継承元 WebControl)
TagKey

DataGrid コントロールの HtmlTextWriterTag 値を取得します。

TagKey

この Web サーバー コントロールに対応する HtmlTextWriterTag 値を取得します。 このプロパティは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
TagName

コントロール タグの名前を取得します。 このプロパティは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
TemplateControl

このコントロールを格納しているテンプレートへの参照を取得または設定します。

(継承元 Control)
TemplateSourceDirectory

現在のサーバー コントロールを格納している Page または UserControl の仮想ディレクトリを取得します。

(継承元 Control)
ToolTip

マウス ポインターが Web サーバー コントロールの上を移動したときに表示されるテキストを取得または設定します。

(継承元 WebControl)
UniqueID

階層構造で修飾されたサーバー コントロールの一意の ID を取得します。

(継承元 Control)
UseAccessibleHeader

データ リスト コントロールのヘッダーをユーザー補助対応の形式で表示するかどうか示す値を取得または設定します。 このプロパティは、補助技術デバイスのユーザーにとって、より使いやすいコントロールを実現するための手段として用意されています。

(継承元 BaseDataList)
ValidateRequestMode

ブラウザーからのクライアント入力の安全性をコントロールで調べるかどうかを示す値を取得または設定します。

(継承元 Control)
ViewState

同一のページに対する複数の要求にわたって、サーバー コントロールのビューステートを保存し、復元できるようにする状態情報のディクショナリを取得します。

(継承元 Control)
ViewStateIgnoresCase

StateBag オブジェクトが大文字小文字を区別しないかどうかを示す値を取得します。

(継承元 Control)
ViewStateMode

このコントロールのビューステート モードを取得または設定します。

(継承元 Control)
VirtualItemCount

カスタム ページングを使用している場合の DataGrid コントロールの仮想項目数を取得または設定します。

Visible

サーバー コントロールがページ上の UI としてレンダリングされているかどうかを示す値を取得または設定します。

(継承元 Control)
Width

Web サーバー コントロールの幅を取得または設定します。

(継承元 WebControl)

メソッド

AddAttributesToRender(HtmlTextWriter)

指定した HtmlTextWriterTag に表示する必要のある HTML 属性およびスタイルを追加します。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
AddedControl(Control, Int32)

子コントロールが Control オブジェクトの Controls コレクションに追加された後に呼び出されます。

(継承元 Control)
AddParsedSubObject(Object)

サーバー コントロールに、XML または HTML の要素が解析されたことを通知し、その要素をサーバー コントロールの ControlCollection コレクションに追加します。

(継承元 BaseDataList)
ApplyStyle(Style)

指定したスタイルの空白以外の要素を Web コントロールにコピーして、コントロールの既存のスタイル要素を上書きします。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
ApplyStyleSheetSkin(Page)

ページのスタイル シートに定義されたスタイル プロパティをコントロールに適用します。

(継承元 Control)
BeginRenderTracing(TextWriter, Object)

レンダリング データのデザイン時のトレースを開始します。

(継承元 Control)
BuildProfileTree(String, Boolean)

ページのトレースが有効な場合、サーバー コントロールに関する情報を収集し、これを表示するために Trace プロパティに渡します。

(継承元 Control)
ClearCachedClientID()

キャッシュされた ClientID 値を null に設定します。

(継承元 Control)
ClearChildControlState()

サーバー コントロールのすべての子コントロールについて、コントロールの状態情報を削除します。

(継承元 Control)
ClearChildState()

サーバー コントロールのすべての子コントロールのビューステート情報およびコントロールの状態情報を削除します。

(継承元 Control)
ClearChildViewState()

サーバー コントロールのすべての子コントロールのビューステート情報を削除します。

(継承元 Control)
ClearEffectiveClientIDMode()

現在のコントロール インスタンスおよびすべての子コントロールの ClientIDMode プロパティを Inherit に設定します。

(継承元 Control)
CopyBaseAttributes(WebControl)

指定した Web サーバー コントロールから、Style オブジェクトでカプセル化されていないプロパティをこのメソッドの呼び出し元の Web サーバー コントロールにコピーします。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
CreateChildControls()

ビューステートを使用して子コントロールを作成します。

(継承元 BaseDataList)
CreateColumnSet(PagedDataSource, Boolean)

コントロール階層の構築に使用する列のセットを作成します。 AutoGenerateColumns が true の場合、データ ソースと一致するように列が作成され、Columns コレクションで定義される列の集合に追加されます。

CreateControlCollection()

サーバー コントロールの子コントロール (リテラルとサーバーの両方) を保持する新しい ControlCollection オブジェクトを作成します。

(継承元 Control)
CreateControlHierarchy(Boolean)

DataGrid を表示するために使用されるコントロール階層を作成します。

CreateControlStyle()

新しいコントロール スタイルを作成します。

CreateDataSourceSelectArguments()

引数が指定されていない場合にデータ バインド コントロールが使用する、既定の DataSourceSelectArguments オブジェクトを作成します。

(継承元 BaseDataList)
CreateItem(Int32, Int32, ListItemType)

DataGridItem オブジェクトを作成します。

DataBind()

指定されたデータ ソースにコントロールとそのすべての子コントロールをバインドします。

(継承元 BaseDataList)
DataBind(Boolean)

DataBinding イベントを発生させるオプションを指定して、呼び出されたサーバー コントロールとそのすべての子コントロールにデータ ソースをバインドします。

(継承元 Control)
DataBindChildren()

データ ソースをサーバー コントロールの子コントロールにバインドします。

(継承元 Control)
Dispose()

サーバー コントロールが、メモリから解放される前に最終的なクリーンアップを実行できるようにします。

(継承元 Control)
EndRenderTracing(TextWriter, Object)

レンダリング データのデザイン時のトレースを終了します。

(継承元 Control)
EnsureChildControls()

サーバー コントロールに子コントロールが含まれているかどうかを確認します。 含まれていない場合、子コントロールを作成します。

(継承元 Control)
EnsureDataBound()

データ リスト コントロールにデータ バインディングが必要かどうか、および有効なデータ ソース コントロールが指定されているどうかを、DataBind() メソッドを呼び出す前に確認します。

(継承元 BaseDataList)
EnsureID()

ID が割り当てられていないコントロールの ID を作成します。

(継承元 Control)
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
FindControl(String)

指定した id パラメーターを使用して、サーバー コントロールの現在の名前付けコンテナーを検索します。

(継承元 Control)
FindControl(String, Int32)

指定した id および検索に役立つ pathOffset パラメーターに指定された整数を使用して、サーバー コントロールの現在の名前付けコンテナーを検索します。 この形式の FindControl メソッドはオーバーライドしないでください。

(継承元 Control)
Focus()

コントロールに入力フォーカスを設定します。

(継承元 Control)
GetData()

データ ソースを表す IEnumerable 実装オブジェクトを返します。

(継承元 BaseDataList)
GetDesignModeState()

コントロールのデザイン時データを取得します。

(継承元 Control)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetRouteUrl(Object)

ルート パラメーターのセットに対応する URL を取得します。

(継承元 Control)
GetRouteUrl(RouteValueDictionary)

ルート パラメーターのセットに対応する URL を取得します。

(継承元 Control)
GetRouteUrl(String, Object)

ルート パラメーターのセットおよびルート名に対応する URL を取得します。

(継承元 Control)
GetRouteUrl(String, RouteValueDictionary)

ルート パラメーターのセットおよびルート名に対応する URL を取得します。

(継承元 Control)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetUniqueIDRelativeTo(Control)

指定されたコントロールの UniqueID プロパティのプレフィックス部分を返します。

(継承元 Control)
HasControls()

サーバー コントロールに子コントロールが含まれているかどうかを確認します。

(継承元 Control)
HasEvents()

コントロールまたは子コントロールに対してイベントが登録されているかどうかを示す値を返します。

(継承元 Control)
InitializeItem(DataGridItem, DataGridColumn[])

指定した DataGridItem オブジェクトを初期化します。

InitializePager(DataGridItem, Int32, PagedDataSource)

ページング UI を格納した DataGridItem オブジェクトを作成します。

IsLiteralContent()

サーバー コントロールがリテラルな内容だけを保持しているかどうかを決定します。

(継承元 Control)
LoadControlState(Object)

SaveControlState() メソッドによって保存された前回のページ要求からコントロールの状態情報を復元します。

(継承元 Control)
LoadViewState(Object)

DataGrid の保存された状態を読み込みます。

MapPathSecure(String)

仮想パス (絶対パスまたは相対パス) の割り当て先の物理パスを取得します。

(継承元 Control)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
MergeStyle(Style)

指定したスタイルの空白以外の要素を Web コントロールにコピーしますが、コントロールの既存のスタイル要素は上書きしません。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
OnBubbleEvent(Object, EventArgs)

コンテナー内のコントロールによって発生したイベントをページの UI サーバー コントロール階層の上位に渡します。

OnCancelCommand(DataGridCommandEventArgs)

CancelCommand イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnDataBinding(EventArgs)

DataBinding コントロールの BaseDataList イベントを発生させます。

(継承元 BaseDataList)
OnDataPropertyChanged()

基本データ ソースの識別プロパティが変更された場合に、データ バインド コントロールをデータに再バインドするために呼び出されます。

(継承元 BaseDataList)
OnDataSourceViewChanged(Object, EventArgs)

DataSourceViewChanged イベントを発生させます。

(継承元 BaseDataList)
OnDeleteCommand(DataGridCommandEventArgs)

DeleteCommand イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnEditCommand(DataGridCommandEventArgs)

EditCommand イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnInit(EventArgs)

BaseDataList コントロールの Init イベントを発生させます。

(継承元 BaseDataList)
OnItemCommand(DataGridCommandEventArgs)

ItemCommand イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnItemCreated(DataGridItemEventArgs)

ItemCreated イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnItemDataBound(DataGridItemEventArgs)

ItemDataBound イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnLoad(EventArgs)

Load イベントを発生させます。

(継承元 BaseDataList)
OnPageIndexChanged(DataGridPageChangedEventArgs)

PageIndexChanged イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnPreRender(EventArgs)

PreRender イベントを発生させます。

(継承元 BaseDataList)
OnSelectedIndexChanged(EventArgs)

SelectedIndexChanged コントロールの BaseDataList イベントを発生させます。

(継承元 BaseDataList)
OnSortCommand(DataGridSortCommandEventArgs)

SortCommand イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OnUnload(EventArgs)

Unload イベントを発生させます。

(継承元 Control)
OnUpdateCommand(DataGridCommandEventArgs)

UpdateCommand イベントを発生させます。 これにより、イベントのカスタム ハンドラーを作成できます。

OpenFile(String)

ファイルの読み込みで使用される Stream を取得します。

(継承元 Control)
PrepareControlHierarchy()

この DataGrid コントロールのコントロール階層を設定します。

RaiseBubbleEvent(Object, EventArgs)

イベントのソースおよびその情報をコントロールの親に割り当てます。

(継承元 Control)
RemovedControl(Control)

Control オブジェクトの Controls コレクションから子コントロールが削除された後に呼び出されます。

(継承元 Control)
Render(HtmlTextWriter)

指定された HTML ライターにコントロールを描画します。

(継承元 BaseDataList)
RenderBeginTag(HtmlTextWriter)

コントロールの HTML 開始タグを指定したライターに表示します。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
RenderChildren(HtmlTextWriter)

提供された HtmlTextWriter オブジェクトに対してサーバー コントロールの子のコンテンツを出力すると、クライアントで表示されるコンテンツが記述されます。

(継承元 Control)
RenderContents(HtmlTextWriter)

コントロールの内容を指定したライターに出力します。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
RenderControl(HtmlTextWriter)

指定の HtmlTextWriter オブジェクトにサーバー コントロールの内容を出力し、トレースが有効である場合はコントロールに関するトレース情報を保存します。

(継承元 Control)
RenderControl(HtmlTextWriter, ControlAdapter)

指定した ControlAdapter オブジェクトを使用して、指定した HtmlTextWriter オブジェクトにサーバー コントロールの内容を出力します。

(継承元 Control)
RenderEndTag(HtmlTextWriter)

コントロールの HTML 終了タグを指定したライターに表示します。 このメソッドは、主にコントロールの開発者によって使用されます。

(継承元 WebControl)
ResolveAdapter()

指定したコントロールを表示するコントロール アダプターを取得します。

(継承元 Control)
ResolveClientUrl(String)

ブラウザーで使用できる URL を取得します。

(継承元 Control)
ResolveUrl(String)

要求側クライアントで使用できる URL に変換します。

(継承元 Control)
SaveControlState()

ページがサーバーにポスト バックされた時間以降に発生したすべてのサーバー コントロール状態の変化を保存します。

(継承元 Control)
SaveViewState()

DataGrid の現在の状態を保存します。

SetDesignModeState(IDictionary)

コントロールのデザイン時データを設定します。

(継承元 Control)
SetRenderMethodDelegate(RenderMethod)

サーバー コントロールとその内容を親コントロールに表示するイベント ハンドラー デリゲートを割り当てます。

(継承元 Control)
SetTraceData(Object, Object)

トレース データ キーとトレース データ値を使用して、レンダリング データのデザイン時トレースのトレース データを設定します。

(継承元 Control)
SetTraceData(Object, Object, Object)

トレースされたオブジェクト、トレース データ キー、およびトレース データ値を使用して、レンダリング データのデザイン時トレースのトレース データを設定します。

(継承元 Control)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TrackViewState()

コントロールへの変更の追跡および保存の開始点を、コントロールのビューステートの一部としてマークします。

イベント

CancelCommand

DataGrid コントロールの項目に対して Cancel ボタンがクリックされたときに発生します。

DataBinding

サーバー コントロールがデータ ソースに連結すると発生します。

(継承元 Control)
DeleteCommand

DataGrid コントロールの項目に対して Delete ボタンがクリックされたときに発生します。

Disposed

サーバー コントロールがメモリから解放されると発生します。これは、ASP.NET ページが要求されている場合のサーバー コントロールの有効期間における最終段階です。

(継承元 Control)
EditCommand

DataGrid コントロールの項目に対して Edit ボタンがクリックされたときに発生します。

Init

サーバー コントロールが初期化されると発生します。これは、サーバー コントロールの有効期間における最初の手順です。

(継承元 Control)
ItemCommand

DataGrid コントロールの任意のボタンがクリックされたときに発生します。

ItemCreated

DataGrid コントロールに項目が作成されたときにサーバーで発生します。

ItemDataBound

項目が DataGrid コントロールにデータ連結された後に発生します。

Load

サーバー コントロールが Page オブジェクトに読み込まれると発生します。

(継承元 Control)
PageIndexChanged

ページ選択要素の 1 つがクリックされると発生します。

PreRender

Control オブジェクトの読み込み後、表示を開始する前に発生します。

(継承元 Control)
SelectedIndexChanged

サーバーへのポスト間でデータ リスト コントロールの別の項目が選択されると発生します。

(継承元 BaseDataList)
SortCommand

列が並べ替えられたときに発生します。

Unload

サーバー コントロールがメモリからアンロードされると発生します。

(継承元 Control)
UpdateCommand

DataGrid コントロールの項目に対して Update ボタンがクリックされたときに発生します。

明示的なインターフェイスの実装

IAttributeAccessor.GetAttribute(String)

指定された名前の Web コントロールの属性を取得します。

(継承元 WebControl)
IAttributeAccessor.SetAttribute(String, String)

Web コントロールの属性を指定された名前と値に設定します。

(継承元 WebControl)
IControlBuilderAccessor.ControlBuilder

このメンバーの詳細については、「ControlBuilder」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.GetDesignModeState()

このメンバーの詳細については、「GetDesignModeState()」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary)

このメンバーの詳細については、「SetDesignModeState(IDictionary)」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.SetOwnerControl(Control)

このメンバーの詳細については、「SetOwnerControl(Control)」をご覧ください。

(継承元 Control)
IControlDesignerAccessor.UserData

このメンバーの詳細については、「UserData」をご覧ください。

(継承元 Control)
IDataBindingsAccessor.DataBindings

このメンバーの詳細については、「DataBindings」をご覧ください。

(継承元 Control)
IDataBindingsAccessor.HasDataBindings

このメンバーの詳細については、「HasDataBindings」をご覧ください。

(継承元 Control)
IExpressionsAccessor.Expressions

このメンバーの詳細については、「Expressions」をご覧ください。

(継承元 Control)
IExpressionsAccessor.HasExpressions

このメンバーの詳細については、「HasExpressions」をご覧ください。

(継承元 Control)
IParserAccessor.AddParsedSubObject(Object)

このメンバーの詳細については、「AddParsedSubObject(Object)」をご覧ください。

(継承元 Control)

拡張メソッド

FindDataSourceControl(Control)

指定されたコントロールのデータ コントロールに関連付けられているデータ ソースを返します。

FindFieldTemplate(Control, String)

指定されたコントロールの名前付けコンテナー内にある、指定された列のフィールド テンプレートを返します。

FindMetaTable(Control)

格納しているデータ コントロールのメタテーブル オブジェクトを返します。

GetDefaultValues(INamingContainer)

指定されたデータ コントロールの既定値のコレクションを取得します。

GetMetaTable(INamingContainer)

指定されたデータ コントロールのテーブル メタデータを取得します。

SetMetaTable(INamingContainer, MetaTable)

指定されたデータ コントロールのテーブル メタデータを設定します。

SetMetaTable(INamingContainer, MetaTable, IDictionary<String,Object>)

指定したデータ コントロールのテーブル メタデータおよび既定値のマッピングを設定します。

SetMetaTable(INamingContainer, MetaTable, Object)

指定したデータ コントロールのテーブル メタデータおよび既定値のマッピングを設定します。

TryGetMetaTable(INamingContainer, MetaTable)

テーブル メタデータが使用できるかどうかを判断します。

EnableDynamicData(INamingContainer, Type)

指定されたデータ コントロールの動的データの動作を有効にします。

EnableDynamicData(INamingContainer, Type, IDictionary<String,Object>)

指定されたデータ コントロールの動的データの動作を有効にします。

EnableDynamicData(INamingContainer, Type, Object)

指定されたデータ コントロールの動的データの動作を有効にします。

適用対象

こちらもご覧ください