Content template and the master page !

Posted by .Netlearner under ASP.NET on 6/19/2012 | Points: 10 | Views : 1362 | Status : [Member] | Replies : 4
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 ?




Responses

Posted by: Jpchoudhari on: 6/19/2012 [Member] Starter | Points: 25

Up
0
Down
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. | Alert Moderator

Posted by: .Netlearner on: 6/19/2012 [Member] Starter | Points: 25

Up
0
Down
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. | Alert Moderator

Posted by: Johnbhatt on: 6/23/2012 [Member] Starter | Points: 25

Up
0
Down
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. | Alert Moderator

Posted by: .Netlearner on: 6/25/2012 [Member] Starter | Points: 25

Up
0
Down
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. | Alert Moderator

Login to post response