首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

前台页面直接条用后台程序失误

2012-07-23 
前台页面直接条用后台程序出错我后台有一个protect void 类型的GetData方法,前台条用时候提示上下文不存在

前台页面直接条用后台程序出错
我后台有一个protect void 类型的GetData方法,前台条用时候提示上下文不存在名称
前台代码
<%@ Page Language="C#" MasterPageFile="~/MasterPage/FormPage.master" AutoEventWireup="true" CodeBehind="Finance.aspx.cs" Inherits="AdenWeb.Finance.FinancePage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentData" runat="server">
  <%GetData(); %>
</asp:Content>

后台代码
namespace AdenWeb.Finance
{
  public partial class FinancePage : WebForm
  {

  protected void GetData()
  {
  try
  {
  Response.Write("test");
  }
  catch (Exception e)
  {
   
  }
  }

  }


[解决办法]
protected => public
[解决办法]
public void GetData()
[解决办法]
楼上正解!
[解决办法]
一楼二楼正解,页面访问后台方法,必须是公共方法...
[解决办法]
<%=GetData(); %>

热点排行