Det skal så give <ul><li><a href="/profil.aspx">Medarbejdesnvn</a> <ul> <li><a href="/">MenuA</a></li> <li><a href="/test.aspx">MenuB</a></li> </ul> </li> </ul>
Det jeg ikke kan finde ud af hvordan jeg laver sådan MenuItems og Menu del
<TypeConverter(GetType(ExpandableObjectConverter))> _ Public Class Links Private _LinkTitle As String Private _LinkUrl As String Private _LinkRole As String
Public Sub New() Me.New(String.Empty, String.Empty, String.Empty) End Sub
Public Sub New(ByVal LinkTitle As String, ByVal LinkUrl As String, ByVal LinkRole As String) _LinkTitle = LinkTitle _LinkUrl = LinkUrl _LinkRole = LinkRole End Sub
<Category("Behavior"), DefaultValue(""), Description("Title"), NotifyParentProperty(True)> _ Public Property LinkTitle() As String Get Return _LinkTitle End Get Set(value As String) _LinkTitle = value End Set End Property
<Category("Behavior"), DefaultValue(""), Description("Url"), NotifyParentProperty(True)> _ Public Property LinkUrl() As String Get Return _LinkUrl End Get Set(value As String) _LinkUrl = value End Set End Property
<Category("Behavior"), DefaultValue(""), Description("Role"), NotifyParentProperty(True)> _ Public Property LinkRole() As String Get Return _LinkRole End Get Set(value As String) _LinkRole = value End Set End Property
End Class
<DefaultProperty("Links"), ParseChildren(True, "Links"), ToolboxData("<{0}:UserNameMenu runat=""server""> </{0}:UserNameMenu>")> _ Public Class UserNameMenu Inherits CompositeControl
Private lnkUserName As New HyperLink Private lnkUserLogout As New LinkButton
Private LinksList As ArrayList
<Category("Behavior"), Description("The contacts collection"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.InnerDefaultProperty)> _ Public ReadOnly Property Links() As ArrayList Get If LinksList Is Nothing Then LinksList = New ArrayList End If Return LinksList End Get End Property
Protected Overrides Sub CreateChildControls() Controls.Clear() lnkUserName.Text = My.User.Name.ToString lnkUserName.NavigateUrl = "/default.aspx" Controls.Add(lnkUserName) lnkUserLogout.Text = "Log af" Controls.Add(lnkUserLogout) AddHandler lnkUserLogout.Click, AddressOf UserLogout_Click End Sub
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter) writer.WriteBeginTag("ul>") writer.WriteBeginTag("li>") lnkUserName.RenderControl(writer)
If (LinksList IsNot Nothing) AndAlso (LinksList.Count > 0) Then For Each item As Links In LinksList Dim LinksItem As Links = TryCast(item, Links) If LinksItem IsNot Nothing Then 'Her skal den så indsætte links til brugernavn.. End If Next End If
writer.WriteEndTag("li") writer.WriteBeginTag("li>") lnkUserLogout.RenderControl(writer) writer.WriteEndTag("li") writer.WriteEndTag("ul") End Sub
Private Sub UserLogout_Click(sender As Object, e As EventArgs) 'Throw New NotImplementedException FormsAuthentication.SignOut() FormsAuthentication.RedirectToLoginPage() End Sub End Class End Namespace
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.