G
Guest
I need some help understanding how I can create a function in a class file
that is available to every page on my site and that can interact with a
placeholder control that is already on the page. Below is a code sameple that
doesn't work, could someone point me in the right direction?
---from Global_Class.vb
Public Class Global_Class
Public Sub add_control_test(byref placeholder as
system.ui.webcontrols.placeholder)
dim new_text_box as System.web.ui.webcontrols.textbox
new_text_box.text="test"
placeholder.controls.add(new_text_box)
End Class
---from default.aspx
<body blah blah>
<asplaceholder id="PlaceHolder1" runat="server"></asplaceholder>
</html> yada yadda
---from default.aspx.vb
Public Class _default
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
Dim global_class As New <website>.Global_Class
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
global_class.add_control_test(PlaceHolder1)
End Sub
End Class
Any help would be greatly appreciated!
TIA,
Blax...
that is available to every page on my site and that can interact with a
placeholder control that is already on the page. Below is a code sameple that
doesn't work, could someone point me in the right direction?
---from Global_Class.vb
Public Class Global_Class
Public Sub add_control_test(byref placeholder as
system.ui.webcontrols.placeholder)
dim new_text_box as System.web.ui.webcontrols.textbox
new_text_box.text="test"
placeholder.controls.add(new_text_box)
End Class
---from default.aspx
<body blah blah>
<asplaceholder id="PlaceHolder1" runat="server"></asplaceholder>
</html> yada yadda
---from default.aspx.vb
Public Class _default
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
Dim global_class As New <website>.Global_Class
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
global_class.add_control_test(PlaceHolder1)
End Sub
End Class
Any help would be greatly appreciated!
TIA,
Blax...