共用方式為


MenuItem.PopOutImageUrl 屬性

定義

取得或設定顯示在功能表項目中之影像的 URL,表示該功能表項目具有動態子功能表。

public:
 property System::String ^ PopOutImageUrl { System::String ^ get(); void set(System::String ^ value); };
public string PopOutImageUrl { get; set; }
member this.PopOutImageUrl : string with get, set
Public Property PopOutImageUrl As String

屬性值

String

顯示在功能表項目中之影像的 URL,表示該功能表項目具有動態子功能表。 預設為空字串 (""),表示這個屬性未設定。

範例

下列範例示範如何使用 PopOutImageUrl 屬性來指定自訂影像,以在功能表項目具有動態子功能表時顯示在功能表項目中。


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

<!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" >
  <head runat="server">
    <title>MenuItem Declarative Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItem Declarative Example</h3>
    
      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Create submenu items   -->
      <!-- by nesting them within parent menu     -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical" 
        target="_blank"  
        runat="server">

        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            imageurl="Images\Home.gif"
            popoutimageurl="Images\Popout.jpg"   
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              popoutimageurl="Images\Popout.jpg"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              popoutimageurl="Images\Popout.jpg"              
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

<%@ Page Language="VB" %>

<!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" >
  <head runat="server">
    <title>MenuItem Declarative Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItem Declarative Example</h3>
    
      <!-- Use declarative syntax to create the   -->
      <!-- menu structure. Create submenu items   -->
      <!-- by nesting them within parent menu     -->
      <!-- items.                                 -->
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical" 
        target="_blank"  
        runat="server">

        <items>
          <asp:menuitem navigateurl="Home.aspx" 
            text="Home"
            imageurl="Images\Home.gif"
            popoutimageurl="Images\Popout.jpg"   
            tooltip="Home">
            <asp:menuitem navigateurl="Music.aspx"
              text="Music"
              popoutimageurl="Images\Popout.jpg"
              tooltip="Music">
              <asp:menuitem navigateurl="Classical.aspx" 
                text="Classical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Classical"/>
              <asp:menuitem navigateurl="Rock.aspx"
                text="Rock"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Rock"/>
              <asp:menuitem navigateurl="Jazz.aspx"
                text="Jazz"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem navigateurl="Movies.aspx"
              text="Movies"
              popoutimageurl="Images\Popout.jpg"              
              tooltip="Movies">
              <asp:menuitem navigateurl="Action.aspx"
                text="Action"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Action"/>
              <asp:menuitem navigateurl="Drama.aspx"
                text="Drama"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Drama"/>
              <asp:menuitem navigateurl="Musical.aspx"
                text="Musical"
                separatorimageurl="Images\Separator.jpg"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>

    </form>
  </body>
</html>

備註

如果 設定為 List ,或者 如果 System.Web.UI.WebControls.MenuRenderingMode System.Web.UI.WebControls.MenuRenderingMode 設定 Default 為 且 PagesSection.ControlRenderingCompatibilityVersion 設定為 4.0 或更新版本,則此屬性沒有作用。 使用 Menu.DynamicEnableDefaultPopOutImage 屬性或 Menu.StaticEnableDefaultPopOutImage 屬性,而不是這個屬性。

如果 設定為 Table ,或 設定 System.Web.UI.WebControls.MenuRenderingMode System.Web.UI.WebControls.MenuRenderingMode Default 為 ,且 PagesSection.ControlRenderingCompatibilityVersion 設定 3.5 為 ,請使用這個屬性來指定顯示在功能表項目中的自訂影像,以指出功能表項目具有動態子功能表。 只要用戶端的瀏覽器支援該格式,此影像可以是任何檔案格式 (.jpg、.gif、.bmp等等) 。

注意

設定此屬性會覆寫 和 Menu.StaticPopOutImageUrl 屬性所 Menu.DynamicPopOutImageUrl 指定的影像。

您也可以在靜態功能表中停用此影像,方法是將此屬性設定為空字串,並將 屬性設定 StaticEnableDefaultPopOutImagefalse 。 同樣地,您可以將此屬性設定為空字串,並將 屬性 false 設定 DynamicEnableDefaultPopOutImage 為 ,以在動態功能表中停用此影像。

適用於

另請參閱