Multiple page load error

D

David C

I am getting the error below and I cannot figure out what to do to fix it.
I only have 1 Page_Load event in my code behind page and the error refers to
that line where Page_Load subroutine starts. Below the error is my
Page_Load code. Can anyone help? Thanks.

David

An unhandled exception occurred:

Message: c:\inetpub\wwwroot\BodyShop\JobImages.aspx.vb(6): error BC30269:
'Protected Sub Page_Load(sender As Object, e As System.EventArgs)' has
multiple definitions with identical signatures.

Stack Trace:

at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath
virtualPath)

at
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean
allowBuildInPrecompile)

at
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext
context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp,
Boolean allowBuildInPrecompile)

at
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath
virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)

at
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath
virtualPath, Type requiredBaseType, HttpContext context, Boolean
allowCrossApp, Boolean noAssert)

at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context,
String requestType, VirtualPath virtualPath, String physicalPath)

at
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext
context, String requestType, VirtualPath virtualPath, String physicalPath)

at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)

at
System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)



Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not Request.QueryString("ro") Is Nothing Then
Dim strFolderName As String = ""
Dim strRepairOrderID As String =
Request.QueryString("ro").ToString
Dim strurl As String = "OpenOrders.aspx?ro=" & strRepairOrderID
Dim bolLines As Boolean = False
If Not Request.QueryString("lines") Is Nothing Then
strurl &= "&lines=" & Request.QueryString("lines").ToString
If Request.QueryString("lines").ToString = "yes" Then
bolLines = True
End If
BtnReturn.PostBackUrl = strurl
End If

Dim strRecordID As String = ""
Dim conData As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("MgmtConnectionString").ConnectionString)
conData.Open()

Dim strSQL As String = ""
strSQL = "SELECT Customer, Vehicle, InsuranceID, RepairOrderID,
RecordID, FolderName" & _
" FROM dbo.vw_RepairOrdersOpen" & _
" WHERE RepairOrderID = " & strRepairOrderID

Dim cmdSelect As SqlCommand = New SqlCommand(strSQL, conData)
Dim dtr As SqlDataReader = cmdSelect.ExecuteReader()
If dtr.HasRows Then
While dtr.Read()
strFolderName = dtr("FolderName").ToString
strRecordID = dtr("RecordID").ToString
Dim lbl As Label =
Page.Master.FindControl("LblCustomer")
lbl.Text = dtr("Customer")
lbl = Page.Master.FindControl("LblVehicle")
lbl.Text = dtr("Vehicle")
Dim tx As TextBox =
Page.Master.FindControl("txtRecordID")
tx.Text = strRecordID
tx = Page.Master.FindControl("txtRepairOrderID")
tx.Text = dtr("RepairOrderID").ToString
Dim Lbtn As LinkButton
Lbtn = Page.Master.FindControl("LBtnReports")
If bolLines = True Then
Lbtn.PostBackUrl =
"reports/ReportSelection.aspx?ro=" & strRepairOrderID & "&lines=yes"
Else
Lbtn.PostBackUrl =
"reports/ReportSelection.aspx?ro=" & strRepairOrderID & "&lines=no"
End If
End While
End If

'On the first page visit, populate the photos
If Not Page.IsPostBack Then
'First page visit
txtMsg.Text = strFolderName

If strFolderName <> "" Then
'Run function to replace any illegal folder characters
If Right(strFolderName, 1) = "\" Then
strFolderName = Left(strFolderName,
Len(strFolderName) - 1)
End If

Dim strFolderPath As String = "~/Photos/" &
strFolderName
Dim strFolderPathPhy = Server.MapPath(strFolderPath)

If
My.Computer.FileSystem.DirectoryExists(strFolderPathPhy) = False Then
Dim virtualFolderPath As String = strFolderPath &
"/RO" & strRepairOrderID
'Get information about the files in the specified
folder
Dim strPhysicalPath As String =
Server.MapPath(virtualFolderPath).ToString
Dim folder As New DirectoryInfo(strPhysicalPath)
If
My.Computer.FileSystem.DirectoryExists(strPhysicalPath) Then
'Dim fileList As FileInfo() =
folder.GetFiles("*.tif")
Dim fileList As FileInfo() =
folder.GetFiles("Initial*.jpg")
Dim pics As ArrayList = New ArrayList()
Dim s As String

For Each s In
Directory.GetFiles(strPhysicalPath, "*.jpg")
'Get information about the image
pics.Add(s)
'currentImage.Dispose()
Next

PicturesInFolder.DataSource = pics
PicturesInFolder.DataBind()
End If
End If
End If
End If
End If
End Sub
 
G

Gregory A. Beamer

I am getting the error below and I cannot figure out what to do to fix
it. I only have 1 Page_Load event in my code behind page and the error
refers to that line where Page_Load subroutine starts. Below the
error is my Page_Load code. Can anyone help? Thanks.

David

A few possibilities:

1. The second Page_Load is in the tagged portion of the ASPX pair
2. The second Page_Load is in the design file
3. You are inheriting from a base class that has a Page_Load method in
it
4. You have changed something that confused the compiler

#3 is unlikely, I would imagine, as you would have purposefully done
this.

#1 and #2 are a check of all of the files surrounding that ASPX. The
design file is unlikely and only applies to newer versions of ASP.NET
(1.x, for example, does not have a separate designer file)

#4 is generally fixed by clearing out the temporary ASP.NET files, which
often means restarting IIS. The files are under %WIN_DIR%\Microsoft.NET
\{Framework version}\Temporary ASP.NET files

If the problem persists, you likely have some code that is confusing the
compiler. Most times it is something you added to web.config that is
correct from a parse standpoint, but creates files. Profile additions
can cause similar errors.

If you still have problems, one thing to try is to remove the offending
file from the project, compile, create a new one, copy over the code and
then try another compile.

One more thing, check the @Page directive in the page file and make sure
you are looking at the right VB file. This is rare, but renaming a file,
if you did that, or copy and paste, can lead you to this issue.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top