Hello All,
I have a navigation system for the site , in which the links are highlighted
based on which section the site is in. Now the issue is that I do that using
a class="thissect ion" attribute as show in the below example
<li><a href="../themes/" id="n_themes" class="thissect ion" runat="server"[color=blue]
>THEMES</a></li>[/color]
How can I dynamically alter it in code behind, that is add attributes to an
html control using code behind ?
My current code behind does something like this to make the links bold, but
need to add the class attribute to the currently selected section.
Uri inUrl = Request.Url;
String strURL = inUrl.AbsoluteU ri;
if (strURL.IndexOf ("themes") > 0)
{
n_themes.InnerH tml = "<strong>THEMES </strong>";
n_themes = "";
}
else
{
if (strURL.IndexOf ("bookmarks" ) > 0)
{
n_bookmarks.Inn erHtml = "<strong>BOOKMA RKS</strong>";
}
else
{
if (strURL.IndexOf ("members") > 0)
{
n_members.Inner Html = "<strong>MEMBER S</strong>";
}
else
{
if (strURL.IndexOf ("sources") > 0)
{
n_sources.Inner Html = "<strong>SOURCE S</strong>";
}
else
{
if (strURL.IndexOf ("_admin") > 0)
{
n_admin.InnerHt ml = "<strong>AD MIN</strong>";
}
else
{
n_home.InnerHtm l = "<strong>HO ME</strong>";
}
}
}
}
}
Thanks a lot,
Imran
I have a navigation system for the site , in which the links are highlighted
based on which section the site is in. Now the issue is that I do that using
a class="thissect ion" attribute as show in the below example
<li><a href="../themes/" id="n_themes" class="thissect ion" runat="server"[color=blue]
>THEMES</a></li>[/color]
How can I dynamically alter it in code behind, that is add attributes to an
html control using code behind ?
My current code behind does something like this to make the links bold, but
need to add the class attribute to the currently selected section.
Uri inUrl = Request.Url;
String strURL = inUrl.AbsoluteU ri;
if (strURL.IndexOf ("themes") > 0)
{
n_themes.InnerH tml = "<strong>THEMES </strong>";
n_themes = "";
}
else
{
if (strURL.IndexOf ("bookmarks" ) > 0)
{
n_bookmarks.Inn erHtml = "<strong>BOOKMA RKS</strong>";
}
else
{
if (strURL.IndexOf ("members") > 0)
{
n_members.Inner Html = "<strong>MEMBER S</strong>";
}
else
{
if (strURL.IndexOf ("sources") > 0)
{
n_sources.Inner Html = "<strong>SOURCE S</strong>";
}
else
{
if (strURL.IndexOf ("_admin") > 0)
{
n_admin.InnerHt ml = "<strong>AD MIN</strong>";
}
else
{
n_home.InnerHtm l = "<strong>HO ME</strong>";
}
}
}
}
}
Thanks a lot,
Imran
Comment