我无法理解问题所在。我收到的错误是:
' ASP.newevents_aspx
'不包含' BUSAVEInfo_Click
'的定义没有扩展方法' BUSAVEInfo_Click
'接受类型' ASP.newevents_aspx
'的第一个参数。可以找到(你错过了使用指令或汇编引用吗?)我觉得我已经做好了一切。请让我知道我错过了什么。我已经学习了几个星期的ASP.NET。感谢。
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewEvents.aspx.cs" Inherits="NewEvents" %>
<!-- CSS, HEAD and BODY Tags removed to compress content --!>
<form id="form1" runat="server">
<div>
<%-- Event Name Field --%>
<asp:Label ID="Label1" runat="server" Text="Event Name: " Width="100"></asp:Label> <asp:TextBox ID="Ename" runat="server" Width="408px" CssClass="auto-style2"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Name is Required" ControlToValidate="Ename"> </asp:RequiredFieldValidator>
<%-- Event Description Field --%>
<asp:Label ID="Label2"
runat="server"
Text="Event Description:"
Width="120px"
CssClass="auto-style1">
</asp:Label>
<asp:TextBox
ID="Escript"
runat="server"
Width="408px"
></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2"
runat="server"
ErrorMessage="Description is Required"
ControlToValidate="Escript">
</asp:RequiredFieldValidator>
<%-- Event Coordinater Name Field --%>
<asp:Label
ID="EventCordNm"
runat="server"
Text="Coordinater Name: ">
</asp:Label>
<asp:TextBox
ID="ECordNm"
runat="server"
CssClass="auto-style4"
Width="409px">
</asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator3"
runat="server"
ErrorMessage="Coordinator Name is Required"
ControlToValidate="ECordNm">
</asp:RequiredFieldValidator>
<br />
<br />
<%-- Event Coordinater Phone Field --%>
<asp:Label
ID="EventCordPn"
runat="server"
Text=" Coordinater Phone#: ">
</asp:Label>
<asp:TextBox
ID="ECordNum"
runat="server"
CssClass="auto-style5"
Width="368px">
</asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator4"
runat="server"
ErrorMessage="Phone Number is Required"
ControlToValidate="ECordNum">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1"
runat="server" ControlToValidate="ECordNum"
ErrorMessage="Invalid Phone Number"
ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}">
</asp:RegularExpressionValidator>
<br />
<br />
<%-- Event Coordinater Email Field --%>
<asp:Label
ID="EventCordEml"
runat="server"
Text=" Coordinater Email: ">
</asp:Label>
<asp:TextBox
ID="ECordEml"
runat="server"
CssClass="auto-style6"
Width="375px">
</asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator5"
runat="server"
ErrorMessage="Email is Required"
ControlToValidate="ECordEml">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator2"
runat="server"
ControlToValidate="ECordEml"
ErrorMessage="Invalid Email Address"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</asp:RegularExpressionValidator>
<br />
<br />
<%-- Event Fee Field --%>
<asp:Label ID="EventFee"
runat="server"
Width="100"
Text="Event Fee:">
</asp:Label>
<asp:TextBox
ID="EvFee"
runat="server"
Width="100"
></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator6"
runat="server"
ControlToValidate="EvFee"
ErrorMessage="Fee is Required">
</asp:RequiredFieldValidator>
<asp:CompareValidator
ID="CompareValidator1"
runat="server"
ControlToValidate="EvFee"
ErrorMessage="CompareValidator"
Operator="GreaterThan"
Type="Double"
ValueToCompare="0">Price Must be greater than 0
</asp:CompareValidator>
<br />
<%-- Event Date Field --%>
<asp:Label ID="Label3"
runat="server"
Width="100"
Text="Event Date:">
</asp:Label>
<asp:TextBox
ID="EDate"
runat="server"
Width="90"
></asp:TextBox>
<br />
<br />
<%-- Event Calender Field --%>
<asp:Calendar
ID="Calendar1"
runat="server"
Align="center"
OneDayRender="Calender1_Dayrender"
OnSelectionChanged="Calender1_SelectionChanged">
</asp:Calendar>
<br /> <br/>
<asp:Button
ID="BtnReturn"
runat="server"
Text="Return"
PostBackUrl="default.aspx" />
<asp:Button
ID="BUSaveInfo"
runat="server"
Text="Save"
Width="100"
OnClick="BUSAVEInfo_Click"
CausesValidation="false"
/>
</div>
代码背后
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class NewEvents : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e){}
public void Calender1_Dayrender(Object sender, DayRenderEventArgs e){ }
public void Calender1_SelectionChanged(Object sender, EventArgs e){
EDate.Text = Calendar1.SelectedDate.ToString("MM/dd/yyyy");
}
protected void BUSaveInfo_Click(Object sender, EventArgs e){}
}
答案 0 :(得分:1)
这是你的大写。 BUSaveInfo_Click
是方法的名称,但BUSAVEInfo_Click
是标记中的内容。
他们需要匹配。