问题
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?
UPDATE
I tried jackjop's suggestions, but F7 did nothing, and I do not seem to have the "Show All Files" glyph:
UPDATE 2
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" %>
回答1:
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.
来源:https://stackoverflow.com/questions/43327349/how-can-i-add-a-code-behind-file-to-an-aspx-page