OK asp.net is not my language at all. However I have been asked to modify a predefined site with a breadcrumb index all in blue shades.
This is how it looks like now:
so now I have the need to change the colour of only one of the items listed in the picture let's say making the foreground yellow....
OK so as I said I am no expert at all or better I don't fully understand how that works. For what I know each pages is helped in the navigation with the same breadcrumb index which is taken from the web.sitemap file which is like that:
<?xml version="1.0" encoding="utf-8" ?>
<siteMapNode title="Comunicazioni" url="~/SiteMap/Comunicazioni/Default.aspx" description="Comunicazioni verso gli iscritti">
<siteMapNode url="~/SiteMap/Comunicazioni/IscrizioneCancellazione.aspx" title="Iscrizione Cancellazione" description="Permette di iscriversi o cancellarsi dalla newsletter" />
<siteMapNode url="~/SiteMap/Comunicazioni/IscrizioniProssimaGara.aspx" title="Iscrizioni alla prossima gara" description="Permette di iscriversi alla prossima gara e vedere chi si e' gia' iscritto" />
<siteMapNode url="~/SiteMap/Comunicazioni/ProssimeGare.aspx" title="Prossime Gare" description="Mostra l'elenco delle prossime gare" />
<siteMapNode url="~/SiteMap/Comunicazioni/ProssimoAllenamento.aspx" title="Prossimo Allenamento" description="Mostra quanto il coach ha deciso per il prossimo allenamento" />
<siteMapNode url="~/SiteMap/Comunicazioni/ElencoTotaleGare.aspx" title="Elenco Totale Gare" description="Mostra le gare per tutto l'anno" />
<siteMapNode url="~/SiteMap/Comunicazioni/IscrizioneGrugliaschiamo.aspx" title="Iscrizioni alla Grugliaschiamo" description="Iscrizioni alla Grugliaschiamo" />
</siteMapNode>
<siteMapNode title="Report" url="~/SiteMap/Report/Default.aspx" description="Informazioni e testimonianze dalle gare">
....
</siteMapNode>
<siteMapNode title="Altro" url="~/SiteMap/Altro/Default.aspx" description="Informazioni e risorse aggiuntive">
...
</siteMapNode>
<siteMapNode title="Regolamento" url="~/SiteMap/Regolamento/Default.aspx" description="Regolamento">
....
</siteMapNode>
</siteMapNode>
this for the names, for the colour and so on from the style.css file which I will copy here below.
All the information provided above might not be the right one so please before banning this question tell me what is wrong and I will reformulate is properly. Thanks
/*--------------------*
* Pagina totale *
*--------------------*/
body
{
margin: 0;
background-image: url("Resources/Pics/background.jpg");
background-size:cover
padding-bottom: 2em;
background-color: #ADFEFF;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
border-top: 2px solid #B51032;
}
/*-------------*
* Header *
*-------------*/
#header
{
border-top: 3px solid #B51032;
border-bottom: 1px dotted #B51032;
height: 10em;
background-image: url("Resources/Pics/BannerDoratletica.png");
background-size: cover
}
#header .title
{
font: 190% Arial, Helvetica, Georgia, "Times New Roman", Times, serif;
color: black;
background-color: transparent;
float: left;
margin-right: 2em;
margin-top: 0.3em;
margin-left: .8em;
}
#header .breadcrumb
{
color: black;
background-color: transparent;
float: right;
margin-right: 2em;
margin-top: 0.8em;
font-weight:bold;
font-style: normal;
font-variant: normal;
font-size: 90%;
line-height: normal;
font-family: Arial, Helvetica, Georgia, "Times New Roman", Times, serif;
height: 75px;
width: 306px;
margin-left: 62px;
}
#header a:link, a:visited
{
color: #B51032;
}
#body {
padding:10px;
padding-bottom:60px; /* Height of the footer */
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
/*-------------*
* Navigazione *
*-------------*/
#navigation
{
width: 200px;
top: 11.45em;
left: 1em;
width: 13em;
position:absolute;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:90%;
}
#navigation ul
{
list-style: none;
margin: 0;
padding: 0;
}
#navigation li
{
border-bottom: 1px solid #ED9F9F;
}
/*--Blocchi superiori--*/
#navigation li a
{
display: block;
padding: 5px 5px 5px 0.5em;
border-left: 12px solid #0000FF;
border-right: 1px solid #0000FF;
background-color: #9090FF;
color: #FFFFFF;
text-decoration: none;
}
#navigation li a:hover
{
background-color: #0000FF;
color: #FFFFFF;
}
#navigation ul ul
{
margin-left: 12px;
}
#navigation ul ul li
{
border-bottom: 1px solid #711515;
margin:0;
background-color: #ED9F9F;
color: #711515;
}
/*-----Blocchi primari----*/
#navigation ul ul a:link, #navigation ul ul a:visited
{
background-color: #C2D7FF;
color: #0000FF;
}
#navigation ul ul a:hover
{
background-color: #0000FF;
color: #FFFFFF;
}
/* Main Content */
#content
{
margin-top:1em;
margin-left: 16em;
margin-right: 2em;
}
h1 {
font: 150% Arial, Helvetica, Georgia, "Times New Roman", Times, serif;
}
#content p {
font-size: 80%;
line-height: 1.6em;
}
#content ul {
font-size: 80%;
line-height: 1.6em;
}
---EDIT---ADD---
Upon suggestion I have focused on a part. That is the Site.Master file in which I have found that
<asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1" EnableViewState="False">
<ItemTemplate>
<li>
<asp:HyperLink x:name="AAA" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
<asp:Repeater runat="server" DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>'>
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li>
<asp:HyperLink name="AAA" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink> <-------
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</li>
If I could access the hyperlink named "AAA" at page load I could change its foreground when equal to a string. Unfortunately the name "AAA" is not accessible from there... Any other way of accessing the repeater in the loop would do anyhow... Thanks
It shouldn't be too difficult. Don't refer it with the name but add a OnPrerender event.
<asp:HyperLink OnPreRender="Unnamed_PreRender" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></asp:HyperLink>
then in the event you can do:
protected void Unnamed_PreRender(object sender, EventArgs e)
{
string str = ((HyperLink)sender).NavigateUrl;
if (str.Contains("XXX")
((HyperLink)sender).ForeColor = System.Drawing.Color.Red;
}
where XXX is part of the name of the url.