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

Dim instance As MenuItemBinding Dim value As String value = instance.ImageUrlField instance.ImageUrlField = value
/** @property */ public String get_ImageUrlField () /** @property */ public void set_ImageUrlField (String value)
MenuItemBinding が適用される MenuItem の ImageUrl にバインドするフィールドの名前。既定値は空の文字列 ("") です。この値は、このプロパティが設定されていないことを示します。

Menu コントロールをデータ ソースにバインドする場合、MenuItem オブジェクトの ImageUrl プロパティにバインドするフィールド名は、ImageUrlField プロパティで指定します。レンダリング時、MenuItemBinding オブジェクトを適用した各メニュー項目の ImageUrl プロパティには、そのフィールドの対応する値が格納されます。このイメージはメニュー項目のテキストの横に表示され、クライアントのブラウザでサポートされてさえいれば、どのようなファイル形式 (.jpg、.gif、.bmp など) でも使用できます。
![]() |
---|
データ ソースに複数のテーブルまたは属性が含まれている場合は、最初に、Depth プロパティと DataMember プロパティのいずれか、または両方を設定してバインディング基準を確立する必要があります。
このプロパティを使用して MenuItem オブジェクトの ImageUrl プロパティをフィールドにバインドする代わりに、MenuItemBinding.ImageUrl プロパティを設定して静的な値にバインドすることもできます。これにより、MenuItemBinding オブジェクトが適用される各メニュー項目に同じイメージを表示できます。

ImageUrlField プロパティを使用して、メニュー項目の ImageUrl プロパティにバインドするフィールド名を指定する方法を次のコード例に示します。この例を正常に動作させるには、以下のサンプル XML データを、Menu.xml という名前のファイルにコピーする必要があります。
<%@ page language="VB" %> <html> <body> <form runat="server"> <h3>MenuItemBinding Example</h3> <asp:menu id="NavigationMenu" datasourceid="MenuSource" runat="server"> <DataBindings> <asp:menuitembinding datamember="MapHomeNode" formatstring="({0})" textfield="Title" valuefield="Description" imageurlfield="ImageUrl" tooltipfield="ToolTip" target="_self" /> <asp:menuitembinding datamember="MapNode" depth="1" formatstring="[{0}]" textfield="Title" valuefield="Description" imageurlfield="ImageUrl" tooltipfield="ToolTip" target="_blank"/> <asp:menuitembinding datamember="MapNode" depth="2" formatstring="<{0}>" textfield="Title" valuefield="Description" imageurlfield="ImageUrl" tooltipfield="ToolTip" target="_blank"/> </DataBindings> </asp:menu> <asp:xmldatasource id="MenuSource" datafile="Menu.xml" runat="server"/> </form> </body> </html>
<%@ page language="C#" %> <html> <body> <form runat="server"> <h3>MenuItemBinding Example</h3> <asp:menu id="NavigationMenu" datasourceid="MenuSource" runat="server"> <DataBindings> <asp:menuitembinding datamember="MapHomeNode" formatstring="({0})" textfield="Title" valuefield="Description" imageurlfield="ImageUrl" tooltipfield="ToolTip" target="_self" /> <asp:menuitembinding datamember="MapNode" depth="1" formatstring="[{0}]" textfield="Title" valuefield="Description" imageurlfield="ImageUrl" tooltipfield="ToolTip" target="_blank"/> <asp:menuitembinding datamember="MapNode" depth="2" formatstring="<{0}>" textfield="Title" valuefield="Description" imageurlfield="ImageUrl" tooltipfield="ToolTip" target="_blank"/> </DataBindings> </asp:menu> <asp:xmldatasource id="MenuSource" datafile="Menu.xml" runat="server"/> </form> </body> </html>
前の例のサンプル サイト マップ データを次のコードに示します。
<MapHomeNode ImageUrl="~\Images\Home.gif"
<MapNode ImageUrl="~\Images\Music.gif"
<MapNode ImageUrl="~\Images\Classical.gif"
Description="Classical Section"
<MapNode ImageUrl="~\Images\Rock.gif"
<MapNode ImageUrl="~\Images\Jazz.gif"
</MapNode>
<MapNode ImageUrl="~\Images\Movies.gif"
<MapNode ImageUrl="~\Images\Action.gif"
<MapNode ImageUrl="~\Images\Drama.gif"
<MapNode ImageUrl="~\Images\Musical.gif"
</MapNode>
</MapHomeNode>

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


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

- MenuItemBinding.ImageUrlField プロパティのページへのリンク