I'm writing a Data Access Layer in a class that lives in the App_Code folder. I'm trying to move all my database access into that layer.
I want to write a method in that class that takes a page as a parameter, as in...
Code:
Public Class DBLayer
Public Shared Sub InsertRecord (ByRef myPage as Page)
'Get the contents of a textbox on the page
Dim myString as String
myString = myPage.myTextbox.Text
End Sub
End Class
Needless to say this doesn't work. I need to be able to cast myPage as an instance of the actual page that calls the DBLayer.InsertRecord method. So if the page is called George.aspx, and the class is named George, I would write...
Code:
Public Shared Sub InsertRecord (ByRef myPage as George)
In ASP.NET 1.1, you could do this simply by declaring the page's class as Public. In 2.0, you can't do that anymore.
So I'm wondering what the way to go is. I'd rather not reference every control on the parent page using FindControl, because there are several dozen controls. The code would get pretty messy.
Thanks for your help.