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

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

FormView.EditItemTemplate プロパティ

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

編集モードの項目用のカスタム コンテンツ取得または設定します

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

<TemplateContainerAttribute(GetType(FormView), BindingDirection.TwoWay)>
 _
Public Overridable Property
 EditItemTemplate As ITemplate
Dim instance As FormView
Dim value As ITemplate

value = instance.EditItemTemplate

instance.EditItemTemplate = value
[TemplateContainerAttribute(typeof(FormView), BindingDirection.TwoWay)] 
public virtual ITemplate EditItemTemplate { get;
 set; }
[TemplateContainerAttribute(typeof(FormView), BindingDirection::TwoWay)] 
public:
virtual property ITemplate^ EditItemTemplate {
    ITemplate^ get ();
    void set (ITemplate^ value);
}
/** @property */
public ITemplate get_EditItemTemplate ()

/** @property */
public void set_EditItemTemplate (ITemplate
 value)
public function get EditItemTemplate
 () : ITemplate

public function set EditItemTemplate
 (value : ITemplate)

プロパティ
FormView コントロール編集モード場合データ行のカスタム コンテンツ含んだ System.Web.UI.ITemplate。既定値null で、このプロパティ設定されていないことを示します

解説解説

FormView コントロールは、コントロールの (CurrentMode プロパティ指定された) 現在のモード基づいて異なテンプレートデータ行に表示します各モードで使用されるテンプレート次の表に示します

モード

表示されるテンプレート

Edit

EditItemTemplate

Insert

InsertItemTemplate

Read-only

ItemTemplate

EditItemTemplate プロパティ使用してFormView コントロール編集モード場合データ行用に独自のユーザー インターフェイス (UI) を定義します通常、項目編集テンプレートには、ユーザー既存レコードの値を更新するための入力コントロールと、レコード更新したり、更新操作キャンセルしたりするためのコマンド ボタン含まれます。

カスタム テンプレート指定するには、最初にFormView コントロール開始タグ終了タグの間に <EditItemTemplate> タグ配置しますその後<EditItemTemplate>開始タグ終了タグの間に、テンプレート内容リスト記述できます双方向バインド式を使用すると、フィールド入力コントロール関連付けることができます。これにより、FormView コントロールは、編集モードで、関連付けられた入力コントロールに元のフィールドの値を自動的に表示できますレコード更新されると、FormView コントロールは、関連付けられた入力コントロールか更新されフィールド値を自動的に抽出します。双方向バインド式の詳細については、「データベースへのバインド」を参照してください組み込みキャンセル操作更新操作実行するコマンド ボタン作成するには、CommandName プロパティ次の表の値のいずれかに設定してコマンド ボタン コントロールテンプレート追加します

項目テンプレート外観は、EditRowStyle プロパティ使用して制御できます

使用例使用例

編集モードデータ行用のカスタム テンプレート定義する方法次の例に示します

<%@ Page language="VB" %>

<html>
  <body>
    <form runat="server">
        
      <h3>FormView Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        emptydatatext="No employees found."  
        runat="server">
        
        <rowstyle backcolor="LightGreen"
          wrap="false"/>
        <editrowstyle backcolor="LightBlue"
          wrap="false"/>

        <itemtemplate>
          <table>
            <tr>
              <td rowspan="4">
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>'
 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <%# Eval("FirstName") %> <%#
 Eval("LastName") %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <%# Eval("Title") %>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="Edit"
                  text="Edit"
                  commandname="Edit"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </itemtemplate>
        <edititemtemplate>
          <table>
            <tr>
              <td rowspan="4">
                <asp:image id="EmployeeEditImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>'
 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <asp:textbox id="FirstNameUpdateTextBox"
                  text='<%# Bind("FirstName") %>'
                  runat="server"/>
                <asp:textbox id="LastNameUpdateTextBox"
                  text='<%# Bind("LastName") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <asp:textbox id="TitleUpdateTextBox"
                  text='<%# Bind("Title") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="UpdateButton"
                  text="Update"
                  commandname="Update"
                  runat="server"/>
                <asp:linkbutton id="CancelButton"
                  text="Cancel"
                  commandname="Cancel"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </edititemtemplate> 
                  
      </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.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName],
 [Title], [PhotoPath] From [Employees]"
        updatecommand="Update [Employees] Set [LastName]=@LastName,
 [FirstName]=@FirstName, [Title]=@Title Where [EmployeeID]=@EmployeeID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
            
    </form>
  </body>
</html>

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

<html>
  <body>
    <form runat="server">
        
      <h3>FormView Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        emptydatatext="No employees found."  
        runat="server">
        
        <rowstyle backcolor="LightGreen"
          wrap="false"/>
        <editrowstyle backcolor="LightBlue"
          wrap="false"/>

        <itemtemplate>
          <table>
            <tr>
              <td rowspan="4">
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <%# Eval("FirstName") %> <%# Eval("LastName")
 %>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <%# Eval("Title") %>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="Edit"
                  text="Edit"
                  commandname="Edit"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </itemtemplate>
        <edititemtemplate>
          <table>
            <tr>
              <td rowspan="4">
                <asp:image id="EmployeeEditImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td colspan="2">
                  &nbsp; 
              </td>
            </tr>
            <tr>
              <td>
                <b>Name:</b>
              </td>
              <td>
                <asp:textbox id="FirstNameUpdateTextBox"
                  text='<%# Bind("FirstName") %>'
                  runat="server"/>
                <asp:textbox id="LastNameUpdateTextBox"
                  text='<%# Bind("LastName") %>'
                  runat="server"/>
              </td>
            </tr>
            <tr>
              <td>
                <b>Title:</b>
              </td>
              <td>
                <asp:textbox id="TitleUpdateTextBox"
                  text='<%# Bind("Title") %>'
                  runat="server"/> 
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:linkbutton id="UpdateButton"
                  text="Update"
                  commandname="Update"
                  runat="server"/>
                <asp:linkbutton id="CancelButton"
                  text="Cancel"
                  commandname="Cancel"
                  runat="server"/> 
              </td>
            </tr>
          </table>       
        </edititemtemplate> 
                  
      </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.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title],
 [PhotoPath] From [Employees]"
        updatecommand="Update [Employees] Set [LastName]=@LastName, [FirstName]=@FirstName,
 [Title]=@Title Where [EmployeeID]=@EmployeeID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
            
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FormView クラス
FormView メンバ
System.Web.UI.WebControls 名前空間
System.Web.UI.ITemplate
EditRowStyle
EmptyDataTemplate
FooterTemplate
HeaderTemplate
InsertItemTemplate
ItemTemplate
PagerTemplate
ItemUpdated
ItemUpdating


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

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

辞書ショートカット

すべての辞書の索引

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

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

   

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



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

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

©2025 GRAS Group, Inc.RSS