jby1,
Thanks for this i really appreciate it.
Now i have taken your advice and created my component as a user control, but it errors with the following.
Object reference not set to an instance of an object.
I have created the neccessary objects on the ascx file, created property functions so i can change look of the toolbar and a Page_Load event in the code behind file to set the style of the toolbar.
I have added the code below for the code behind file of the user control.
Any ideas?
Partial Class MainMenuToolbar
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Set the style of the heading text
hyp_header.Style.Add("font-family", "Arial")
hyp_header.Style.Add("font-size", "x-small")
hyp_header.Style.Add("font-style", "normal")
hyp_header.Style.Add("font-weight", "bold")
hyp_header.Style.Add("line-height", "normal")
hyp_header.Style.Add("color", "#4A519F")
hyp_header.Style.Add("text-decoration", "none")
' Set the style of the description text
hyp_description.Style.Add("font-family", "Arial")
hyp_description.Style.Add("font-size", "xx-small")
hyp_description.Style.Add("font-style", "normal")
hyp_description.Style.Add("line-height", "normal")
hyp_description.Style.Add("font-weight", "normal")
hyp_description.Style.Add("text-decoration", "none")
hyp_description.Style.Add("color", "#000000")
' Create the mouseover and mouseout javascript event strings
Dim MouseOverStr As String = "document.getElementById('" & img_arrow.ClientID & "').src='images/sq_arrow_light.gif'; document.getElementById('" & hyp_header.ClientID & "').style.color='#A4A8CF'; document.getElementById('" & hyp_description.ClientID & "').style.color='#FFFFFF'; document.getElementById('" & tc_header.ClientID & "').style.backgroundColor='#4A519F'; document.getElementById('" & tc_description.ClientID & "').style.backgroundColor='#4A519F'"
Dim MouseOutStr As String = "document.getElementById('" & img_arrow.ClientID & "').src='images/sq_arrow.gif'; document.getElementById('" & hyp_header.ClientID & "').style.color='#4A519F'; document.getElementById('" & hyp_description.ClientID & "').style.color='#000000'; document.getElementById('" & tc_header.ClientID & "').style.backgroundColor='#A4A8CF'; document.getElementById('" & tc_description.ClientID & "').style.backgroundColor='#A4A8CF'"
' Add javascript to image
img_arrow.Attributes("onMouseOver") = MouseOverStr
img_arrow.Attributes("onMouseOut") = MouseOutStr
' Add javascript to main heading cell
tc_header.Attributes.Add("onMouseOver", MouseOverStr)
tc_header.Attributes.Add("onMouseOut", MouseOutStr)
' Add javascript to description cell
tc_description.Attributes.Add("onMouseOver", MouseOverStr)
tc_description.Attributes.Add("onMouseOut", MouseOutStr)
End Sub
' This procedure is used when you want to add a new toolbar, with no arguments
Public Sub New()
End Sub
' This procedure can accept the parameters as well, thus less coding
Public Sub New(ByVal Heading As String, ByVal Description As String, ByVal Url As String)
Toolbar_Heading = Heading
Toolbar_Description = Description
Toolbar_URL = Url
End Sub
' Sets the text for the main heading on a toolbar
WriteOnly Property Toolbar_Heading()
Set(ByVal value)
hyp_header.Text = " " & value
End Set
End Property
' Sets the text fore the description heading on a toolbar
WriteOnly Property Toolbar_Description()
Set(ByVal value)
hyp_description.Text = value
End Set
End Property
' Sets the url that the toolbar is going too
WriteOnly Property Toolbar_URL()
Set(ByVal value)
hyp_header.NavigateUrl = value
hyp_description.NavigateUrl = value
End Set
End Property
End Class