Reputation: 10247
There are two pages in a legacy app to which I'm addding fuctionality.
One of the .aspx files, when the "Design" view is shown, sports an Events tab in the Properties pane:
The other, though, does not - it only shows Properties:
I need to add a custom method to this code; how can I create a corresponding .vb code-behind file where I can add this method?
I tried jackjop's suggestions, but F7 did nothing, and I do not seem to have the "Show All Files" glyph:
I tried adding this to the top of the .aspx file, mirroring what is in the aspx/aspx.vb pair that works as I want, but it didn't seem to make any difference:
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="custmaint_entry.aspx.vb" Inherits="pages_custmaint_entry" %>
Upvotes: 0
Views: 2471
Reputation: 446
The issue here is that the solution was created from a precompiled and deployed application and the code behind files do not get deployed. I can also see many "Copy of" files littering the solution.
I am posting because this is typical in many legacy applications -- the original source code needs to be located -- you cannot modify precompiled code without the source. (Well, you can however you will have to rewrite ALL of the code behind and other custom DLLs). And NO, a "decompiler" is of no use here.
This is what I am doing on my own legacy code, but -- it is a piecemeal task and whether it is better than starting all over is debatable. Unfortunately, the real fix would be for enterprises to maintain a full source code repository.
Upvotes: 1
Reputation: 3600
When you create an ASPX file it also creates a code-behind file. You just can't see it.
From aspx file press F7 or click Show All Files
button in Solution Explorer.
Notice that when Show All Files
is not clicked, it doesn't show code behind files.
Or you can just simply right-click on aspx file on Solution Explorer
and click View Code
. If this also does not work, then you probably deleted the code behind files, I suggest you re-creating every file.
Upvotes: 2