Solved

how do I change the button bgcolor when it is the selected button?

Posted on 2010-09-20
4
397 Views
Last Modified: 2012-05-10
<div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
                    EnableViewState="False"  Orientation="Horizontal" BackColor="#F7F6F3"
                    DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="1.1em"
                    ForeColor="#7C6F57" StaticSubMenuIndent="20px">
                    <StaticSelectedStyle BackColor="#5D7B9D" />
                    <StaticMenuItemStyle HorizontalPadding="15px" VerticalPadding="12px" />
                    <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
                    <DynamicMenuStyle BackColor="#F7F6F3" />
                    <DynamicSelectedStyle BackColor="#5D7B9D" />
                    <DynamicMenuItemStyle HorizontalPadding="15px" VerticalPadding="12px" />
                    <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                        <asp:MenuItem NavigateUrl="Prod/IPCamera.aspx" Text="IP Camera">                        
                            <asp:MenuItem Text="Installation Manual" NavigateUrl="Prod/IP_Cam_UserManual.aspx" Value="Installation Manual">
                            </asp:MenuItem>
                        </asp:MenuItem>
                        <asp:MenuItem NavigateUrl="Prod/ContactUs.aspx" Text="Contact Us"/>
                        <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/>
                    </Items>
                </asp:Menu>
            </div>
0
Comment
Question by:goodk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:goodk
ID: 33726235
ok, All I am asking is how to change the background color of the button on the menu once the button is clicked.
I tried the following but it did not work
<DynamicSelectedStyle BackColor="White" />
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 500 total points
ID: 33749559
Hi Goodk,

Think StaticSelectedStyle only works if the menu has a DataSourceID of type SiteMapDataSource and the SitemapDataSource would need a Web.SiteMap.

The following code snippets set the back color of the selected item to light blue.

hth

Alan
Web.SiteMap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="~/Default4.aspx" title="Default4"  description="">
        <siteMapNode url="~/Default5.aspx" title="Default5"  description="" />
    </siteMapNode>
</siteMap>


Default4.aspx, Default5.aspx


<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
      <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
      <asp:menu id="NavigationMenu" DataSourceID="SiteMapDataSource1"
        staticdisplaylevels="2"
        staticsubmenuindent="10" 
        orientation="Horizontal"
        runat="server">

        <staticselectedstyle backcolor="LightBlue"
          borderstyle="Solid"
          bordercolor="Black"
          borderwidth="1"/>
      </asp:menu>
    </div>
    </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:goodk
ID: 33766197
but I do not have SiteMapDataSource and I do not even know how if I need to do in this instance.
 
Can you kindly cut and paste my code with the change I need to make to change the background color of the selected menu item.
thanks a lot.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question