How to change menu static pop out image in asp.net c#

Change static pop out image url in Menu control
Menu is an asp.net web server control. menu control's StaticPopOutImageUrl property get or set the url to an image displayed to indicate that a static menu item has a submenu. the StaticPopOutImageUrl property value data type is System.String. this 'String' represents the URL to an image displayed to indicate that a static menu item has a sub menu. the default value of this property is empty string which indicate that this property is not set.

this property allow us to change the default image of static menu item which indicate the menu item has a sub menu and user can expand it.

the following asp.net c# example code demonstrate us how can we set or change the menu control's static menu items pop out image which has sub menu programmatically in an asp.net application.
MenuStaticPopOutImageUrl.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        Menu1.StaticPopOutImageUrl = "~/Images/StaticPopOutImage.gif";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to set, change static pop out image url in Menu control</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy; font-style:italic;">Menu Example: StaticPopOutImageUrl</h2>
        <asp:SiteMapDataSource 
             ID="SiteMapDataSource1" 
             runat="server"
             />
        <div style="height:150px">
            <asp:Menu 
                 ID="Menu1" 
                 runat="server" 
                 DataSourceID="SiteMapDataSource1"
                 ForeColor="SkyBlue"
                 Font-Bold="true"
                 StaticDisplayLevels="2"
                 >
            </asp:Menu>
        </div>
        <asp:Button 
             ID="Button1" 
             runat="server"
             ForeColor="Green"
             Text="Change StaticPopOutImageUrl"
             Height="45"
             OnClick="Button1_Click"
             Font-Bold="true"
             />
    </div>
    </form>
</body>
</html>
Web.sitemap
Web.sitemap source code here.

   








Related asp.net examples