我收到此错误-> CS1061:'aspx_index_aspx'不包含'Login'的定义,并且找不到扩展方法'Login'接受类型为'aspx_index_aspx'的第一个参数(您是否缺少using指令还是程序集引用?)
我一直在寻找几个可能的问题,但仍然给我这个错误:
-我在Code Behind上添加了函数Login(object sender,EventArgs e)
-功能受保护
-命名空间和类名称应该可以毫无问题地引用文件后面的代码
这是两个文件(aspx文件和aspx.cs文件):
index.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/master/header.Master" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="project.aspx.index" %>
<asp:Content runat="server" ContentPlaceHolderID="css_holder">
<link rel="stylesheet" type="text/css" href="css/index.css" />
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="login">
<form runat="server">
<h1>SIGN IN</h1>
<div class="row">
<asp:TextBox class="input" placeholder="User Name" onfocus="this.placeholder = ''" onblur="this.placeholder='UserName'" runat="server"></asp:TextBox>
</div>
<div class="row">
<asp:TextBox TextMode="Password" class="input" placeholder="Password" onfocus="this.placeholder = ''" onblur="this.placeholder='Password'" runat="server"></asp:TextBox>
</div>
<div class="row button">
<asp:Button class="button_design" Text="Login" OnClick="Login" runat="server" />
</div>
</form>
</asp:Content>
index.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace project.aspx
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Login(object sender, EventArgs e)
{
}
}
}
谢谢!