Functions not working on new pages

I have a project and the strangest thing is happening.  I have been trying to figure it out for multiple hours.  The issue is if I create a new web form, the code behind will see all the controls, but from the .aspx page I can use any public functions from the code behind.  For example if I create the following function:

        Public Function Hey()
        Return True
    End Function

Open in new window

Then I go to the .aspx source and put the following:

    <%# hey%>

Open in new window

I get the following error: Error      2      'hey' is not declared. It may be inaccessible due to its protection level.

The following is WebForm5.aspx:

          <%@ Page Title="Web Form" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="WebForm5.aspx.vb" Inherits="InventoryManagement.WebForm5" Async="true" %>

    <!DOCTYPE html>
    <html xmlns="">
    <head runat="server">
        <form id="form1" runat="server">
        <%# hey%>

Open in new window


    Public Class WebForm5
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        End Sub
        Public Function Hey()
            Return True
        End Function
    End Class

Open in new window

I have "older" pages that I can call the exact same function from code behind. Any help would be greatly appreciated as this issue has been a problem for the last 3+ hours.  Thanks in advance!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russ SuterSenior Software DeveloperCommented:
Even though VB.Net is not case sensitive is it possible that the aspx rendering engine is? If you write "<%# Hey%>" instead does it work?

This is one of those things that I dislike about VB.Net. Even though it's not case sensitive it's a good practice to maintain a consistent case throughout your calls.
russell12Author Commented:
Thanks for your response, but this is not the case.  In VS2013 as you type, it suggests as you know, and it doesnt suggest any function's in the behind code.  But if I add a textbox and name is txtname, and go into code behind and put on load: txtname.text = "My Name" then on page load txtname.text will = "My Name".  So it is like the code behind can see the controls on the .aspx page, but the .aspx page can not see the functions in the code behind.  If I inherit a class that has been part of the project, then it can see the functions in that class just fine.  I have tried to put a new namespace, new class and I am at a lost.  I dont know if I have a corruption somewhere that is causing this.
russell12Author Commented:
The solution to this issue was to clean and rebuild solution.  Dont know why it did it, but it seems like everytime I create a new page, I have to clean and rebuild in order to call functions from code behind.  Russ, do you have an idea as to why this may be?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
russell12Author Commented:
No one else commented on the issue.  The issue was a simple clean and rebuild.  After doing so, the aspx page could see the code behind public functions.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.