0
我有一个项目,最奇怪的事情正在发生。我一直试图找出多个小时。问题是如果我创建一个新的Web窗体,后面的代码将会看到所有的控件,但是从.aspx页面我可以使用后面代码中的任何公共函数。例如,如果我创建了以下功能:功能不能在新页面上工作asp.net
Public Function Hey()
Return True
End Function
然后我去到.aspx源,并把以下内容:
<%# hey%>
我收到以下错误:错误2“嗨”未声明。由于其保护级别,它可能无法访问。
以下是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
我有,我可以从后面的代码调用完全相同的功能 “老” 的网页。任何帮助将不胜感激,因为这个问题已经过去3个多小时的问题。提前致谢!!