User Control Gives Parser Error about Extending System.Web.UI.Page

T

Tina Daniel

I'm getting "Parser Error Message: 'MyCompany.MyApp.MyUserControlClass' is
not a valid base class because it does not extend class 'System.Web.UI.Page'."

I didn't think that, as a user control, it was supposed to extend
System.Web.UI.Page. It does extend System.Web.UI.UserControl like it's
supposed to.

This is .NET 1.1 and VB.NET.

Any ideas? Thanks.
 
T

Tina Daniel

Thanks for responding, Steve.

Here is the directive line from the .ascx:

<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="MyUserControlClass.ascx.vb"
Inherits="MyCompany.MyApp.MyUserControlClass"%>

Here is the codebehind for the .ascx:

Imports System
Imports System.Web
Imports System.Web.UI.Page
Imports System.Web.UI.WebControls

Namespace MyCompany.MyApp

Public Class MyUserControlClass

Inherits System.Web.UI.UserControl

Private cu As New CommonUtilities
Private app As New ApplicationUtilities

Protected WithEvents hlCompanies As
System.Web.UI.WebControls.HyperLink
Protected WithEvents lblHeader As System.Web.UI.WebControls.Label
Protected WithEvents image_pqDOCS_Logo As
System.Web.UI.WebControls.Image
Protected WithEvents lbLogout As System.Web.UI.WebControls.LinkButton
Protected WithEvents hlDocumentSearch As
System.Web.UI.WebControls.HyperLink
Protected WithEvents hlNewCompany As
System.Web.UI.WebControls.HyperLink
Protected WithEvents lblUserName As System.Web.UI.WebControls.Label
Protected WithEvents hlEdit_UserAccount As
System.Web.UI.WebControls.HyperLink
Protected WithEvents hlEdit_People As
System.Web.UI.WebControls.HyperLink
Protected WithEvents hlProjects As System.Web.UI.WebControls.HyperLink
Protected WithEvents hlNewProject As
System.Web.UI.WebControls.HyperLink
Protected WithEvents image_ApplicationLogo As
System.Web.UI.WebControls.Image
Protected WithEvents hlDocuments As
System.Web.UI.WebControls.HyperLink
Protected WithEvents hlCompanyPeople As
System.Web.UI.WebControls.HyperLink
Protected WithEvents hlNewDocument As
System.Web.UI.WebControls.HyperLink

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region


Public Sub SetMenuLogo(ByVal logoFile As String)
image_ApplicationLogo.ImageUrl = logoFile
End Sub

Private Sub SensitizeNavigationLinks()

' Hide all navigation links to start with
hlCompanies.Visible = False
hlProjects.Visible = False
hlDocuments.Visible = False
hlDocumentSearch.Visible = False
hlCompanyPeople.Visible = False
lbLogout.Visible = False

hlNewCompany.Visible = False
hlNewProject.Visible = False
hlNewDocument.Visible = False
hlEdit_People.Visible = False
hlEdit_UserAccount.Visible = False

' See if there is a username
If (app.GetLoginUserID <> 0) Then

If app.IsAdministrator Then

hlCompanies.Visible = True
hlProjects.Visible = True
hlDocuments.Visible = True
hlDocumentSearch.Visible = True
hlCompanyPeople.Visible = True
lbLogout.Visible = True

hlNewCompany.Visible = True
hlNewProject.Visible = True
hlNewDocument.Visible = True
hlEdit_People.Visible = True
hlEdit_UserAccount.Visible = True

Else ' not administrator

If app.IsProjectLeader Then

hlCompanies.Visible = True
hlProjects.Visible = True
hlDocuments.Visible = True
hlDocumentSearch.Visible = True
hlCompanyPeople.Visible = True
lbLogout.Visible = True

hlNewCompany.Visible = True
hlNewProject.Visible = True
hlNewDocument.Visible = True
'hlEdit_People.Visible = True
'hlEdit_UserAccount.Visible = True

Else ' Not administrator and not project leader

hlCompanies.Visible = True
hlProjects.Visible = True
hlDocuments.Visible = True
hlDocumentSearch.Visible = True
hlCompanyPeople.Visible = True
lbLogout.Visible = True

End If

End If

End If

End Sub

Public Sub SetLoginUserNameLabel(ByVal usernameLabel As String)

lblUserName.Text = usernameLabel

End Sub

Private Sub lbLogout_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lbLogout.Click

SetMenuLogo("images\nothing.jpg")
SetLoginUserNameLabel("")

app.SetLoginUserID("")
app.SetLoginUserName("")

app.SetAdministrator("")
app.SetProjectLeader("")

app.SetClientCode("")

app.SetCompanyID("")
app.SetDocumentID("")
app.SetProjectID("")

SensitizeNavigationLinks()

' Logout
Page.Session.Abandon()
Page.Response.Write("<script language=vbs>" & vbCrLf)

Page.Response.Write("parent.document.location=parent.document.location" &
vbCrLf)
Page.Response.Write("</script>" & vbCrLf)

' Logout
app.SetLoggedInFlag(False) ' Indicate that we are logged-out

End Sub

Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim status As Long
Dim logoFile As String
Dim errorMessage As String
Dim headerText As String
Dim headerLogoFile As String

If (Page.IsPostBack) Then
Exit Sub
End If

' Check for user id in session state...
If app.GetLoginUserName = "" Then
SetLoginUserNameLabel("")
Else
SetLoginUserNameLabel(app.GetLoginUserName)
End If

SensitizeNavigationLinks()

' Get header logo 1
logoFile = app.GetSystemParameter("LogoFile",
"images\nothing.jpg")
SetMenuLogo(logoFile)

' Get header text
headerText = app.GetSystemParameter("HeaderText", "Power Quality
Documents - (pqDOCS)")
lblHeader.Text = headerText

' Get header logo 2
headerText = app.GetSystemParameter("HeaderLogoFile",
"images\pqdocs_logo.jpg")
image_pqDOCS_Logo.ImageUrl = headerText

If (Not app.IsLoggedOut) Then
hlCompanies.Text = app.GetCompanyAlias(True)
hlNewCompany.Text = "New " & app.GetCompanyAlias(False)
hlProjects.Text = app.GetProjectAlias(True)
hlNewProject.Text = "New " & app.GetProjectAlias(False)
hlCompanyPeople.Text = app.GetCompanyAlias(False) & "
Contacts"
End If

End Sub

End Class

End Namespace

Here are the directive lines for one of the .aspx's:

<%@ Register TagPrefix="uc1" TagName="MyUserControlClass"
Src="MyUserControlClass.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Login.aspx.vb"
Inherits="MyCompany.MyApp.Login" SmartNavigation="False" %>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top