S
Simon Harris
Hi All,
I am trying to create a web custom control to handle the banner and footer
areas of our website.
Our site is, in the main ASP/VBScript driven, making heavy use of include
files.
I have two problems/queries:
1) Can I include the content of an ASP file in my control? (You can see
where I have attempted this below with response.writefile - Which VS want
happy with, told me that response was not delcared!)
2) Is my code at all right below? e.g. Am I setting the value of SB in the
right place, such that calling BopDotComHeader.Text will return the value
of
SB?
Thanks,
Simon.
-----------------
Imports System.ComponentModel
Imports System.Web.UI
Imports System.text
<DefaultProperty("Text"), ToolboxData("<{0}:BopDotComHeader
runat=server></{0}:BopDotComHeader>")> Public Class BopDotComHeader
Inherits System.Web.UI.WebControls.WebControl
<Bindable(True), Category("Appearance"), DefaultValue("")> Property
[Text]() As String
Get
Return SB
End Get
Set(ByVal Value As String)
Strtext = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
Dim SB As New StringBuilder
SB.Append("<BASEFONT FACE=ARIAL SIZE=2>")
SB.Append("<A NAME=TOP>")
SB.Append("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>")
SB.Append("<TR>")
SB.Append("<TD WIDTH=100 VALIGN=TOP>")
SB.Append(Response.WriteFile("/template/menu.asp"))
SB.Append("</TD><TD VALIGN=TOP>")
SB.Append(Response.WriteFile("/template/menutop.asp"))
SB.Append("<IMG SRC=/graphics/blank.gif WIDTH=1 HEIGHT=5 BORDER=0
ALT=>")
SB.Append("<CENTER>")
SB.Append("<TABLE WIDTH=540 BORDER=0 CELLPADDING=1 CELLSPACING=3>")
SB.Append("<TR>")
SB.Append("<TD VALIGN=TOP>")
output.Write(SB)
End Sub
End Class
I am trying to create a web custom control to handle the banner and footer
areas of our website.
Our site is, in the main ASP/VBScript driven, making heavy use of include
files.
I have two problems/queries:
1) Can I include the content of an ASP file in my control? (You can see
where I have attempted this below with response.writefile - Which VS want
happy with, told me that response was not delcared!)
2) Is my code at all right below? e.g. Am I setting the value of SB in the
right place, such that calling BopDotComHeader.Text will return the value
of
SB?
Thanks,
Simon.
-----------------
Imports System.ComponentModel
Imports System.Web.UI
Imports System.text
<DefaultProperty("Text"), ToolboxData("<{0}:BopDotComHeader
runat=server></{0}:BopDotComHeader>")> Public Class BopDotComHeader
Inherits System.Web.UI.WebControls.WebControl
<Bindable(True), Category("Appearance"), DefaultValue("")> Property
[Text]() As String
Get
Return SB
End Get
Set(ByVal Value As String)
Strtext = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
Dim SB As New StringBuilder
SB.Append("<BASEFONT FACE=ARIAL SIZE=2>")
SB.Append("<A NAME=TOP>")
SB.Append("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>")
SB.Append("<TR>")
SB.Append("<TD WIDTH=100 VALIGN=TOP>")
SB.Append(Response.WriteFile("/template/menu.asp"))
SB.Append("</TD><TD VALIGN=TOP>")
SB.Append(Response.WriteFile("/template/menutop.asp"))
SB.Append("<IMG SRC=/graphics/blank.gif WIDTH=1 HEIGHT=5 BORDER=0
ALT=>")
SB.Append("<CENTER>")
SB.Append("<TABLE WIDTH=540 BORDER=0 CELLPADDING=1 CELLSPACING=3>")
SB.Append("<TR>")
SB.Append("<TD VALIGN=TOP>")
output.Write(SB)
End Sub
End Class