I
Imran Aziz
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="thissection" attribute as show in the below example
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.AbsoluteUri;
if (strURL.IndexOf("themes") > 0)
{
n_themes.InnerHtml = "<strong>THEMES</strong>";
n_themes = "";
}
else
{
if (strURL.IndexOf("bookmarks") > 0)
{
n_bookmarks.InnerHtml = "<strong>BOOKMARKS</strong>";
}
else
{
if (strURL.IndexOf("members") > 0)
{
n_members.InnerHtml = "<strong>MEMBERS</strong>";
}
else
{
if (strURL.IndexOf("sources") > 0)
{
n_sources.InnerHtml = "<strong>SOURCES</strong>";
}
else
{
if (strURL.IndexOf("_admin") > 0)
{
n_admin.InnerHtml = "<strong>ADMIN</strong>";
}
else
{
n_home.InnerHtml = "<strong>HOME</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="thissection" attribute as show in the below example
THEMES</a></li>
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.AbsoluteUri;
if (strURL.IndexOf("themes") > 0)
{
n_themes.InnerHtml = "<strong>THEMES</strong>";
n_themes = "";
}
else
{
if (strURL.IndexOf("bookmarks") > 0)
{
n_bookmarks.InnerHtml = "<strong>BOOKMARKS</strong>";
}
else
{
if (strURL.IndexOf("members") > 0)
{
n_members.InnerHtml = "<strong>MEMBERS</strong>";
}
else
{
if (strURL.IndexOf("sources") > 0)
{
n_sources.InnerHtml = "<strong>SOURCES</strong>";
}
else
{
if (strURL.IndexOf("_admin") > 0)
{
n_admin.InnerHtml = "<strong>ADMIN</strong>";
}
else
{
n_home.InnerHtml = "<strong>HOME</strong>";
}
}
}
}
}
Thanks a lot,
Imran