Karatas, FERHAT
I would love to change the world, but they won't give me the source code!
Activate current link in master page
14.07.2009 13:21:42 - Filed under : Asp.net | CSS
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
with 0 comments

What do you think ?
Security Code 5841
Check S. Code
Name  
Email  
Home Page  
Comments