A
Anonymous
Hey,
in my init I created some code to create a tabbed
interface. The code worked very well. It simply adds a
table with the required cells/rows to a placeholder, which
is located on the page. Now I tried to implement this in a
seperate class. I created a new namespace which has a
class in it. The class contains a public function, which
is exactly the same code as I had before in init. The
function retuns me a placeholder. From my original webform
then again, I am calling that function and assigning the
return value to the placeholder. However I dont see the
tabed interface? Any idea what it could be? Here is my
code:
Imports Microsoft.ApplicationBlocks.Data
Imports System.Data.SqlClient
Imports System.Data
Namespace intranet
Public Class Menu
Inherits System.Web.UI.Page
Public Function CreateTopTabbedMenu() As
PlaceHolder
....
Dim iLoop As Integer = 0
Dim table As New Table
table.BackColor =
System.Drawing.Color.Gainsboro
table.CellPadding = 2
table.CellSpacing = 0
Dim tr As New TableRow
For iLoop = 0 To dsHeaderLinks.Tables(0).Rows
().Count() - 1
Dim td As New TableCell
td.ID = dsHeaderLinks.Tables(0).Rows(iLoop)
("ID")
If iLoop = 0 Then
td.Attributes.Add
("class", "SelectedCell")
Else
td.Attributes.Add
("class", "UnSelectedCell")
End If
Dim link As New HyperLink
link.Font.Bold = True
link.Text = " " &
dsHeaderLinks.Tables(0).Rows(iLoop)("LinkText")
& " "
link.NavigateUrl = "/intranet" &
dsHeaderLinks.Tables(0).Rows(iLoop)("Link") & "?Index=" &
dsHeaderLinks.Tables(0).Rows(iLoop)("ID")
link.ToolTip = IIf(IsDBNull
(dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip")), "",
dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip"))
td.Controls.Add(link)
tr.Cells.Add(td)
Next
table.Controls.Add(tr)
Dim HeaderMenuHolder As New PlaceHolder
HeaderMenuHolder.Controls.Add(table)
Return HeaderMenuHolder
End Function
End Class
End Namespace
And here is how I am calling to from the webform in init:
Dim objMenu As New intranet.Menu
HeaderMenuHolder = objMenu.CreateTopTabbedMenu()
Thanks
in my init I created some code to create a tabbed
interface. The code worked very well. It simply adds a
table with the required cells/rows to a placeholder, which
is located on the page. Now I tried to implement this in a
seperate class. I created a new namespace which has a
class in it. The class contains a public function, which
is exactly the same code as I had before in init. The
function retuns me a placeholder. From my original webform
then again, I am calling that function and assigning the
return value to the placeholder. However I dont see the
tabed interface? Any idea what it could be? Here is my
code:
Imports Microsoft.ApplicationBlocks.Data
Imports System.Data.SqlClient
Imports System.Data
Namespace intranet
Public Class Menu
Inherits System.Web.UI.Page
Public Function CreateTopTabbedMenu() As
PlaceHolder
....
Dim iLoop As Integer = 0
Dim table As New Table
table.BackColor =
System.Drawing.Color.Gainsboro
table.CellPadding = 2
table.CellSpacing = 0
Dim tr As New TableRow
For iLoop = 0 To dsHeaderLinks.Tables(0).Rows
().Count() - 1
Dim td As New TableCell
td.ID = dsHeaderLinks.Tables(0).Rows(iLoop)
("ID")
If iLoop = 0 Then
td.Attributes.Add
("class", "SelectedCell")
Else
td.Attributes.Add
("class", "UnSelectedCell")
End If
Dim link As New HyperLink
link.Font.Bold = True
link.Text = " " &
dsHeaderLinks.Tables(0).Rows(iLoop)("LinkText")
& " "
link.NavigateUrl = "/intranet" &
dsHeaderLinks.Tables(0).Rows(iLoop)("Link") & "?Index=" &
dsHeaderLinks.Tables(0).Rows(iLoop)("ID")
link.ToolTip = IIf(IsDBNull
(dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip")), "",
dsHeaderLinks.Tables(0).Rows(iLoop)("LinkTooltip"))
td.Controls.Add(link)
tr.Cells.Add(td)
Next
table.Controls.Add(tr)
Dim HeaderMenuHolder As New PlaceHolder
HeaderMenuHolder.Controls.Add(table)
Return HeaderMenuHolder
End Function
End Class
End Namespace
And here is how I am calling to from the webform in init:
Dim objMenu As New intranet.Menu
HeaderMenuHolder = objMenu.CreateTopTabbedMenu()
Thanks