Per aggiungere un'altra soluzione, ho trovato uno UC che feci mesi fa, era simile al tuo ed alla soluzione di Roby.
Adattandolo verrebbe :
ASPX dello UserControl:
codice:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="menu.ascx.vb" Inherits="usercontrols_menu_selezionato_menu" %>
<div id="tabs1">
<ul> [*]
<a href="default.aspx" title="Home page">
<asp:Label ID="voce_home" runat="server" Text="Home"></asp:Label>
</a>
[*]
<a href="pagina2.aspx" title="Pagina2">
<asp:Label ID="voce_pagina2" runat="server" Text="Pagina 2"></asp:Label>
</a>
[*]
<a href="pagina3.aspx" title="Pagina3">
<asp:Label ID="voce_pagina3" runat="server" Text="Pagina 3"></asp:Label>
</a>
[/list]
</div>
Code-Behind dello UserControl:
codice:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' STILE DELLA VOCE SELEZIONATA
Dim stile As New Style
stile.BackColor = Drawing.Color.Yellow
stile.Font.Bold = True
' APPLICO LO STILE
Select Case Trim(LCase(System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.CurrentExecutionFilePath)))
Case "default.aspx"
voce_home.ApplyStyle(stile)
Case "pagina2.aspx"
voce_pagina2.ApplyStyle(stile)
Case "pagina3.aspx"
voce_pagina3.ApplyStyle(stile)
End Select
End Sub