Step 1 : <ul> <li id="<%=current("/Index.aspx,/Contact.aspx") %>"> <a href="/Public/CustomerCare/Index.aspx"><span>Customer</span></a></li> <li id="<%=current("/Contact.aspx") %>"> <a href="/Public/CustomerCare/Contact.aspx"><span>İletişim</span></a></li> </ul>
Step 2 : protected string current(string currentpage) { // activate current link string pname = Request.ServerVariables["SCRIPT_NAME"];
string result = pname.Substring(pname.LastIndexOf("/"), pname.Length - pname.LastIndexOf("/"));
if (currentpage.IndexOf(result)>=0) { result = "current"; } return result; }
Keywords : CSS, activate current page, asp.net
|