Introduction
- <ul>
- <li id="page1" runat="server" >
- <a href="studentHomePage.aspx"> Dashboard </a>
- </li>
- <li id="page2" runat="server">
- <a href="Mytest.aspx"> My Test</a>
- </li>
- <li id="page3" runat="server">
- <a href="TestReport.aspx">Test Report</a>
- </li>
- <li id="page4" runat="server">
- <a href="Subscription_New.aspx">Subscribe</a>
- </li>
- </ul>
Code Bheind
- page_load {
- String activepage= Request.RawUrl;if(activepage .Contains("studentHomePage.aspx")){page1.Attributes("class") = "active";
- }
- else if(activepageactivepage .Contains("Mytest.aspx")) {
- page2.Attributes("class") = "active";
- }
- else if( activepage.Contains("TestReport.aspx") ) {
- page3.Attributes("class") = "active";
- }
- else if( activepage.Contains("Subscription_New.aspx")) {
- page4.Attributes("class") = "active";
- }}




Asad MalikPosted Aug 27, 2020, 9:45 AM EDT
I have multiple pages..[main page and (1)(2)(3)] and all based on a single master page. only first page is active, how to keep the list hyperlink active while on page 2, 3. please guide.
Noora MJPosted Nov 15, 2018, 12:12 PM EST
How can i change the color of active page
Charles McClellanPosted Aug 6, 2018, 6:38 AM EDT
How to make this work with asp:menu and asp:menuitem
Hany KhudairPosted Mar 23, 2018, 1:21 PM EDT
Page1.Attributes.Add("class", "active")
Mohammed HablullahPosted Feb 5, 2018, 4:46 PM EST
How to write this in switch case
Nabeel ArbabPosted May 4, 2016, 2:36 AM EDT
It giving me below error. Non-invocable member 'HtmlControl.Attributes' cannot be used like a method.
Dipayan (DCPL)Posted Feb 18, 2016, 9:42 PM EST
It giving me below error. Non-invocable member 'HtmlControl.Attributes' cannot be used like a method.