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
Then I go to the .aspx source and put the following:
<%# hey%>
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="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%# hey%>
</div>
</form>
</body>
</html>
WebForm5.aspx.vb:
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
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!!
The solution to this issue was to clean and rebuild project. This solved the issue right away!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.