G
Guest
my asp.net page need to display links (<a></a>) as tabs.
I create a class that inherits from HtmlAnchor as:
Public Class Tab
Inherits System.Web.UI.HtmlControls.HtmlAnchor
'(inheriting from HtmlControl is good or bad ????)
Private _Id As String = "myId"
Private _innerHtml As String = "sometext"
Private _href As String = "page.aspx"
Private _target As String = "mytarget"
Public Sub New()
End Sub
Public Overrides Property Id() As String
Get
Return _Id
End Get
Set(ByVal value As String)
_id=value
End Set
End Property
public property ... .. ... ....
'the same as above for the rest of methods
...... .. . . .. . ..
..... .. ..
...
End Class
I want to embed the HtmAnchor control within the aspx page (myDiv is <div
id='myDiv' runat=server></div>:
in the code behind I have:
..... .. . . . ....
Dim a As New Tab
a.HRef = _tab.HREF
a.ID = _tab.Id
a.Target = _tab.Target
a.InnerHtml = _tab.InnerHTML
myDiv.Controls.Add(DirectCast(a, HtmlAnchor))
but the anchor control never rendered on the page.
obviously I'm doing something wrong, what is it?
I create a class that inherits from HtmlAnchor as:
Public Class Tab
Inherits System.Web.UI.HtmlControls.HtmlAnchor
'(inheriting from HtmlControl is good or bad ????)
Private _Id As String = "myId"
Private _innerHtml As String = "sometext"
Private _href As String = "page.aspx"
Private _target As String = "mytarget"
Public Sub New()
End Sub
Public Overrides Property Id() As String
Get
Return _Id
End Get
Set(ByVal value As String)
_id=value
End Set
End Property
public property ... .. ... ....
'the same as above for the rest of methods
...... .. . . .. . ..
..... .. ..
...
End Class
I want to embed the HtmAnchor control within the aspx page (myDiv is <div
id='myDiv' runat=server></div>:
in the code behind I have:
..... .. . . . ....
Dim a As New Tab
a.HRef = _tab.HREF
a.ID = _tab.Id
a.Target = _tab.Target
a.InnerHtml = _tab.InnerHTML
myDiv.Controls.Add(DirectCast(a, HtmlAnchor))
but the anchor control never rendered on the page.
obviously I'm doing something wrong, what is it?