Click here to Skip to main content
15,847,264 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: 'Submit' button related errors Pin
Member 87616676-Jun-14 7:02
Member 87616676-Jun-14 7:02 
GeneralRe: 'Submit' button related errors Pin
Richard Deeming6-Jun-14 8:33
mveRichard Deeming6-Jun-14 8:33 
GeneralRe: 'Submit' button related errors Pin
Member 87616676-Jun-14 8:43
Member 87616676-Jun-14 8:43 
QuestionBeginner: using update_demo.asp - Datatype Mismatch Error Pin
Istteffanny Isloure Araujo4-Jun-14 23:49
Istteffanny Isloure Araujo4-Jun-14 23:49 
AnswerRe: Beginner: using update_demo.asp - Datatype Mismatch Error Pin
thatraja5-Jun-14 0:52
professionalthatraja5-Jun-14 0:52 
QuestionUnable to close a modal pop up after opening an pdf document Pin
aditya kiran maroju4-Jun-14 19:36
aditya kiran maroju4-Jun-14 19:36 
QuestionRe: Unable to close a modal pop up after opening an pdf document Pin
Vasudevan Deepak Kumar13-Jun-14 3:35
Vasudevan Deepak Kumar13-Jun-14 3:35 
Questionhighlight main menu item of current page. Also highlight when sub menu item is selected through javascript in ASP.net Pin
hilbiazhar4-Jun-14 3:41
hilbiazhar4-Jun-14 3:41 
Hi. I Have a master page at the back having menu. I have then created a webform from it.
I want the main menu item to get highlighted on page load. Also I want the main menu item to get highlighted when a sub menu item is loaded.

My code which I have tried so far will follow.

hoping for a solution.

Thanks in advance.

JavaScript
<script src="../Scripts/jquery-2.1.0.js" type="text/javascript"></script>
   <script type="text/javascript">
       $(document).ready(function () {
           $('#nav').find('li a').click(function () {
               $('#nav').find('li a').removeClass('active');
               $(this).addClass('active');
               $($(this).closest('li.menu-item').children()[0]).addClass('active');
           });
       });

   </script>


CSS
#nav {
	height: 50px;
	width: auto;
	position: relative;
	background-color: #ad8f5d;		
}

#nav ul li {
	
	width:150px;
	text-align:center;
} 

#nav ul li a 
{
	color: Black;
	font-size: 13px;
	font-weight: bold;
	line-height:50px;
	text-decoration: none;	
}

 #nav li a.active 
 {
    color:White; 
	 	
 }
 

#nav ul li a.has_submenu {
	background: transparent url('../Images/submenu-item.jpg') no-repeat scroll right center;
	padding-right: 0px;
}

#nav ul li a.has_submenu:hover, #nav ul li.sfHover a.has_submenu {
	background-image: url('../Images/submenu-item-hover.jpg');
}
#nav ul ul li a.has_submenu {
	background: transparent url('../Images/submenu-item-invert.jpg') no-repeat scroll right center;
	padding-right: 0px;
}
#nav ul ul li a.has_submenu:hover, #nav ul ul li.sfHover a.has_submenu {
	background-image: url('../Images/submenu-item-hover-invert.jpg');
}

#nav ul ul li a { 
	float: none; 
	width: 170px;
}

#nav ul > li:hover > a
{
    background-color: #1f478d;
}

#nav ul ul > li:hover > a
{
    background-color: #1f478d;
}

/*--------------------------Item Image Hover change---------------------CSS----*/

#nav ul > li:hover > a.has_submenu
{
    background-image: url('../Images/submenu-item-hover.jpg');
}

#nav ul ul > li:hover > a.has_submenu
{
   background-image: url('../Images/submenu-item-hover-invert.jpg');
}

/*--------------------------Item Image Hover change---------------------CSS ends----*/


#nav ul li a:hover, #nav ul li.sfHover a{
	
	background-color: #1f478d;
	
}
#nav ul ul a 
{

background-color: #ad8f5d;
}

#nav ul li li a:hover, #nav ul li.sfHover li a:hover {
	background-color: #1f478d;
	
} 

 
.sf-menu, .sf-menu * 
{
    height:50px;
	margin:			0;
	padding:		0;
	list-style:		none;
}

.sf-menu ul {
	position:		absolute;
	top:			-999em;
	width:			200px; 
	margin-top: 	0px;
	padding-top:	0;
}
.sf-menu ul li {
	width:			100%;
}
.sf-menu li:hover {
	visibility:		inherit; 
}
.sf-menu li {
	float:			left;
	position:		relative;
}
.sf-menu a {
	display:		block;
	position:		relative;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
	left:			0;
	top:			49px; 
	z-index:		99;
}
ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
	top:			-999em;
}
ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
	left:			170px; 
	top:			0;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
	top:			-999em;
}
ul.sf-menu li li li:hover ul,
ul.sf-menu li li li.sfHover ul {
	left:			10em; 
	top:			0;
} 


HTML
<div id="nav">
    <ul class="sf-menu">
        <li class="menu-item"><a href="Home.aspx">Home</a></li>
        <li class="menu-item"><a class="has_submenu" href="#">Examples</a>
            <ul>
                <li><a href="Static.aspx">Static Text Page</a></li>
                <li><a href="#">Static Frontpage</a></li>
                <li><a href="#">Another link</a></li>
            </ul>
        </li>
        <li   class="menu-item"><a class="has_submenu" href="#">Products</a>
            <ul>
                <li><a href="Product.aspx">Product One</a></li>
                <li><a href="#">Product Two</a></li>
                <li><a href="#">Product Three</a></li>
            </ul>
        </li>
        <li  class="menu-item"><a href="#">Solutions</a></li>
        <li class="menu-item"><a href="#">Contact</a></li>
    </ul>
  </div>

Questionkinect with web Pin
vinayak.ghanti3-Jun-14 21:42
professionalvinayak.ghanti3-Jun-14 21:42 
AnswerRe: kinect with web Pin
Richard MacCutchan3-Jun-14 23:04
mveRichard MacCutchan3-Jun-14 23:04 
QuestionRepeater Control with show and hide boxes Pin
indian1433-Jun-14 11:41
indian1433-Jun-14 11:41 
AnswerRe: Repeater Control with show and hide boxes Pin
DamithSL3-Jun-14 17:47
professionalDamithSL3-Jun-14 17:47 
GeneralRe: Repeater Control with show and hide boxes Pin
indian1435-Jun-14 8:14
indian1435-Jun-14 8:14 
QuestionBeginner to Visual Studio Pin
Member 87616672-Jun-14 14:31
Member 87616672-Jun-14 14:31 
AnswerRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 2:20
mveRichard Deeming3-Jun-14 2:20 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 3:14
Member 87616673-Jun-14 3:14 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 3:49
mveRichard Deeming3-Jun-14 3:49 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 6:07
Member 87616673-Jun-14 6:07 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 6:45
mveRichard Deeming3-Jun-14 6:45 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 7:14
Member 87616673-Jun-14 7:14 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 7:36
mveRichard Deeming3-Jun-14 7:36 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 7:58
Member 87616673-Jun-14 7:58 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 8:20
mveRichard Deeming3-Jun-14 8:20 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 8:32
Member 87616673-Jun-14 8:32 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 8:49
mveRichard Deeming3-Jun-14 8:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.