What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 28176 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > Content template and the master page ! ...
.Netlearner

Content template and the master page !

Replies: 4 | Posted by: .Netlearner on 6/19/2012 | Category: ASP.NET Forums | Views: 508 | Status: [Member] | Points: 10  


Hello All,

Am Using a master page in which i have a menu as follows,


<li id="adminhome" runat="server"><a href="Home.aspx">Home</a></li>
<li id="admincontact" runat="server"><a href="#">Contact</a></li>


Am having a CSS to highlight the selected menu dynamically.

Now i want to place the script as follows in each page to get the menu highted . It gives an error that script file must be writern inside the content place holder.

Am not clear how can i acheive this ?


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Jpchoudhari
Jpchoudhari  
Posted on: 6/19/2012 2:59:41 AM
Level: Starter | Status: [Member] | Points: 25

i guess u can use or give reference to ur css file in head section of master page

Kind Regards,
Jay

.Netlearner, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

.Netlearner
.Netlearner  
Posted on: 6/19/2012 3:15:06 AM
Level: Starter | Status: [Member] | Points: 25

If i choose the Menu home it must be high lighted and if i chose the Contact menu that must be uploaded.
i Have the script as follows
   <script type="text/javascript">

document.getElementById("home").className="selected";
</script>


Home is the ID of the <a> tag

Now how could i use this pls help

.Netlearner, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Johnbhatt
Johnbhatt  
Posted on: 6/23/2012 10:56:54 PM
Level: Starter | Status: [Member] | Points: 25

Include your CSS file in Masterpage. Then go to Head section of Content Page and place the Javascript inside it. Look at Example below:

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script type="text/javascript">
document.getElementById("<%=lnkhome.ClientID%>").className="selected";
</script>
</asp:Content>


Try this code and revert.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

.Netlearner, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

.Netlearner
.Netlearner  
Posted on: 6/25/2012 5:06:44 AM
Level: Starter | Status: [Member] | Points: 25

Am using the menus in the master page itself Please Guide me how to do this Content Place holder is not needed for this na,am using menus in the home page which changes its content dynamically . Hence its a server control. Now i want the menu to be highlighted when the particular menu is selected

.Netlearner, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 1:58:07 PM