I have a .ascx file that I converted to a class.
But I am getting the following error:
error BC30469: Reference to a non-shared member requires an object
reference.
The error is for the Page.FindContro l in the following code:
*************** *************** ************
Imports System
Imports System.Web
Imports System.IO
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Imports System.Web.Sess ionState
Imports System.Data
Imports System.Data.Sql Client
Imports System.Web.Http Cookie
Imports System.Web.Http CookieCollectio n
Imports System.Web.Http Response
Imports System.Web.Http Request
imports System.Web.Http Context
Imports System.Web.Http Application
Imports System.Web.Http ApplicationStat e
Imports System.Collecti ons
NameSpace MyFunctions
Public Class PageInit
Public Shared sub PageSetup ()
Dim UserLoggedOn as Label = CType(Page.Find Control("UserLo ggedOn"),Label)
Dim UserLoggedOnLab el as Label =
CType(Page.Find Control("UserLo ggedOnLabel"),L abel)
if not UserLoggedOn is nothing then
if HttpContext.Cur rent.session("L oggedIn") <nothing then
if HttpContext.Cur rent.session("f irstName") <nothing then
UserLoggedOn.Te xt = UserLoggedOn.Te xt &
HttpContext.Cur rent.session("f irstName")
if HttpContext.Cur rent.session("l astName") <nothing then
UserLoggedOn.Te xt = UserLoggedOn.Te xt & " " &
HttpContext.Cur rent.session("l astName")
end if
end if
if not UserLoggedOn is nothing then
UserLoggedOn.vi sible = true
if not UserLoggedOnLab el is nothing then UserLoggedOnLab el.visible =
true
end if
end if
end if
if not HttpContext.Cur rent.session("U ser") is nothing then _
HttpContext.Cur rent.session("L astPageVisited" ) =
HttpContext.Cur rent.Session("U ser").LastPageV isited
End Sub
End Class
End Namespace
*************** *************** *************** *************** *************
Why am I getting this error?
Do I need something in front the Page.FindContro l?
Thanks,
Tom