CommandField.InsertText プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As CommandField Dim value As String value = instance.InsertText instance.InsertText = value
[LocalizableAttribute(true)] public: virtual property String^ InsertText { String^ get (); void set (String^ value); }
/** @property */ public String get_InsertText () /** @property */ public void set_InsertText (String value)
CommandField の Insert ボタンのキャプション。既定値は "挿入" です。

CommandField フィールドの ButtonType プロパティが ButtonType.Button または ButtonType.Link に設定されている場合は、InsertText プロパティを使用して、Insert ボタンに表示するテキストを指定します。
![]() |
---|
Insert ボタンにテキストを表示する代わりに、ButtonType プロパティを ButtonType.Image に設定し、次に InsertImageUrl プロパティを設定して、イメージを表示することもできます。 |
このプロパティを設定している場合、デザイナ ツールを使用して、その値を自動的にリソース ファイルに保存できます。詳細については、LocalizableAttribute、ASP.NET のグローバリゼーションおよびローカリゼーション の各トピックを参照してください。

InsertText プロパティを使用して、DetailsView コントロールの CommandField フィールドに表示される Insert ボタンのカスタム キャプションを指定する方法を次のコード例に示します。
<%@ Page language="VB" %> <html> <body> <form runat="server"> <h3>CommandField Example</h3> <asp:detailsview id="CustomersGridView" datasourceid="CustomersSqlDataSource" autogeneraterows="false" datakeynames="CustomerID" allowpaging="true" runat="server"> <fields> <asp:boundfield datafield="CustomerID" headertext="Customer ID" /> <asp:boundfield datafield="CompanyName" headertext="CompanyName"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="ZIP Code"/> <asp:boundfield datafield="Country" headertext="Country"/> <asp:commandfield showinsertbutton="true" inserttext="Save" newtext="Add New Customer" showheader="true" headertext="Add Customer"/> </fields> </asp:detailsview> <!-- 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="CustomersSqlDataSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" insertcommand="Insert Into [Customers]([CustomerID], [CompanyName], [City], [PostalCode], [Country]) Values (@CustomerID, @CompanyName, @City, @PostalCode, @Country)" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"> </asp:sqldatasource> </form> </body> </html>
<%@ Page language="C#" %> <html> <body> <form runat="server"> <h3>CommandField Example</h3> <asp:detailsview id="CustomersGridView" datasourceid="CustomersSqlDataSource" autogeneraterows="false" datakeynames="CustomerID" allowpaging="true" runat="server"> <fields> <asp:boundfield datafield="CustomerID" headertext="Customer ID" /> <asp:boundfield datafield="CompanyName" headertext="CompanyName"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="ZIP Code"/> <asp:boundfield datafield="Country" headertext="Country"/> <asp:commandfield showinsertbutton="true" inserttext="Save" newtext="Add New Customer" showheader="true" headertext="Add Customer"/> </fields> </asp:detailsview> <!-- 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="CustomersSqlDataSource" selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]" insertcommand="Insert Into [Customers]([CustomerID], [CompanyName], [City], [PostalCode], [Country]) Values (@CustomerID, @CompanyName, @City, @PostalCode, @Country)" connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" runat="server"> </asp:sqldatasource> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CommandField クラス
CommandField メンバ
System.Web.UI.WebControls 名前空間
ButtonFieldBase.ButtonType プロパティ
CommandField.CancelImageUrl プロパティ
CommandField.CancelText プロパティ
CommandField.DeleteImageUrl プロパティ
CommandField.DeleteText プロパティ
CommandField.EditImageUrl プロパティ
CommandField.EditText プロパティ
CommandField.InsertImageUrl プロパティ
NewImageUrl
NewText
SelectImageUrl
SelectText
ShowCancelButton
ShowInsertButton
UpdateImageUrl
UpdateText
- CommandField.InsertText プロパティのページへのリンク