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

[LocalizableAttribute(true)] public: property String^ Text { String^ get (); void set (String^ value); }
TreeNodeBinding オブジェクトが適用されるノードに表示されるテキスト。既定値は空の文字列 ("") です。

TreeView コントロールをデータ ソースにバインドする場合、TreeNode オブジェクトの Text プロパティにバインドする値は、Text プロパティで指定します。このバインディングの関係は、TreeNodeBinding オブジェクトが適用されるすべての TreeNode オブジェクトに影響します。Text プロパティを使用して、ノードに表示するテキストを指定します。
![]() |
---|
Text を使用して同じテキストを各ノードにバインドする代わりに、TextField プロパティを設定して、TreeNode オブジェクトの Text プロパティをデータ ソースのフィールドにバインドできます。
このプロパティの値は、設定時に、デザイナ ツールを使用してリソース ファイルに自動的に保存できます。詳細については、LocalizableAttribute のトピックおよび「ASP.NET のグローバリゼーションおよびローカリゼーション」を参照してください。

このセクションには、2 つのコード例が含まれています。Text プロパティを使用して、TreeNodeBinding オブジェクトが適用されるノードに表示する値を指定する方法を最初のコード例に示します。最初のコード例に対応したサンプル XML データを 2 番目のコード例に示します。
Text プロパティを使用して、TreeNodeBinding オブジェクトが適用されるノードに表示する値を指定する方法を次の例に示します。この例を正常に動作させるには、このコード例の後に示すサンプル XML データを、Booklist.xml という名前のファイルにコピーする必要があります。
<%@ Page Language="VB" %> <html> <body> <form runat="server"> <h3>TreeViewBinding Example</h3> <!-- Set the Text, ImageUrl, ImageToolTip, --> <!-- NavigateUrl, Value, and ToolTip --> <!-- properties of a TreeNodeBinding --> <!-- object declaratively. --> <asp:TreeView id="BookTreeView" DataSourceID="BookXmlDataSource" Target="_blank" runat="server"> <DataBindings> <asp:TreeNodeBinding DataMember="Books" Depth="0" TextField="Text"/> <asp:TreeNodeBinding DataMember="Book" Depth="1" Text="Book Title" ImageUrl="Image.jpg" ImageToolTip="Book Image" NavigateUrl="http://www.microsoft.com" Value="BookID" ToolTip="Book Information"/> <asp:TreeNodeBinding DataMember="Description" Depth="2" TextField="Text"/> <asp:TreeNodeBinding DataMember="Price" Depth="2" TextField="Value"/> </DataBindings> </asp:TreeView> <asp:XmlDataSource id="BookXmlDataSource" DataFile="Booklist.xml" runat="server"> </asp:XmlDataSource> </form> </body> </html>
<%@ Page Language="C#" %> <html> <body> <form runat="server"> <h3>TreeViewBinding Example</h3> <!-- Set the Text, ImageUrl, ImageToolTip, --> <!-- NavigateUrl, Value, and ToolTip --> <!-- properties of a TreeNodeBinding --> <!-- object declaratively. --> <asp:TreeView id="BookTreeView" DataSourceID="BookXmlDataSource" Target="_blank" runat="server"> <DataBindings> <asp:TreeNodeBinding DataMember="Books" Depth="0" TextField="Text"/> <asp:TreeNodeBinding DataMember="Book" Depth="1" Text="Book Title" ImageUrl="Image.jpg" ImageToolTip="Book Image" NavigateUrl="http://www.microsoft.com" Value="BookID" ToolTip="Book Information"/> <asp:TreeNodeBinding DataMember="Description" Depth="2" TextField="Text"/> <asp:TreeNodeBinding DataMember="Price" Depth="2" TextField="Value"/> </DataBindings> </asp:TreeView> <asp:XmlDataSource id="BookXmlDataSource" DataFile="Booklist.xml" runat="server"> </asp:XmlDataSource> </form> </body> </html>
前のコード例に対応したサンプル XML データを次のコード例に示します。
<Books Text="Books List"> <Book Text="Book Title One" Value="1" Image="Bookimage1.jpg" ImageToolTip="Book 1 Photo" Nav="http://www.microsoft.com" Tip="Book Title 1"> <Description Text="Book Description"> </Description> <Price Value="$1.99"> </Price> <Author Text="Author Name" Value="LastName" Image="Authorimage1.jpg" Nav="http://www.microsoft.com" Tip="Author Name"> </Author> </Book> <Book Text="Book Title Two" Value="2" Image="Bookimage2.jpg" ImageToolTip="Book 2 Photo" Nav="http://www.microsoft.com" Tip="Click Me"> <Description Text="Book Description"> </Description> <Price Value="$2.99"> </Price> <Author Text="Author Name" Value="LastName" Image="Authorimage2.jpg" Nav="http://www.microsoft.com" Tip="Author Name"> </Author> </Book> </Books>

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


TreeNodeBinding クラス
TreeNodeBinding メンバ
System.Web.UI.WebControls 名前空間
TreeView
TreeNode クラス
DataBindings
TreeNodeBinding.DataMember プロパティ
TreeNodeBinding.Depth プロパティ
TreeNode.ImageUrl プロパティ
TreeNodeBinding.ImageUrl プロパティ
TreeNodeBinding.ImageUrlField プロパティ
TreeNodeBinding.ImageToolTip プロパティ
TreeNodeBinding.ImageToolTipField プロパティ
TreeNode.NavigateUrl プロパティ
TreeNodeBinding.NavigateUrl プロパティ
TreeNodeBinding.NavigateUrlField プロパティ
TreeNode.Text プロパティ
TextField
TreeNode.ToolTip プロパティ
TreeNodeBinding.ToolTip
ToolTipField
TreeNode.Value プロパティ
TreeNodeBinding.Value
ValueField
Weblioに収録されているすべての辞書からTreeNodeBinding.Text プロパティを検索する場合は、下記のリンクをクリックしてください。

- TreeNodeBinding.Text プロパティのページへのリンク