There is an existing site with no compiled DLLs, it's all .aspx.vb and .aspx files.
First question is that I can see
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master"
CodeFile="ThisPageName.aspx.vb" Inherits="ThisPageName" %>
Partial Class ThisPageName
Protected Sub btnWasHidden_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Compiler Error Message: BC30506: Handles clause requires a WithEvents variable
defined in the containing type or one of its base types.
E:\path\path\htdocs\ThisPageName.aspx.vb(304) : error BC30451:
Name 'btnWasHidden' is not declared.
I am not sure about non-compiled sites, but normally the "other half" of the page class is kept in the
pagename.aspx.designer.vb file, which VS updates as you modify the markup (.aspx) page.
If you are doing this outside of the context of Visual Studio, you might need to add the member variable for the control to the class manually in either the designer file or your main class file (code behind).
EDIT: Here is how the
.aspx.designer.vb file typically generates member variables for server-side controls:
Protected WithEvents <control_id> As <full namespace and type of control>
Protected WithEvents TextBox1 As Global.System.Web.UI.WebControls.Button
Just follow that pattern in the normal code-behind .vb file and it should work.
In your case I believe it will be:
Protected WithEvents btnWasHidden As Global.System.Web.UI.WebControls.Button