Никакая перегрузка для системы "InsertButton_Click" не соответствует системе "делегат".EventHandler' [ошибка]
Почему моя обработка событий не работает? Я получаю эту ошибку. Я использую VS 2008 / .NET 3.5 SP1 / Win XP, и, на всякий случай, исходный код доступен здесь.
Ошибка 1 отсутствие перегрузки для системы "InsertButton_Click" соответствует системе "делегат".EventHandler' c:\inetpub\wwwroot\Jon ' S Couch\Articles. aspx. cs 21 31 http://localhost/Jon кушетка/
Статьи.aspx-файл
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Articles.aspx.cs" Inherits="Articles" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> <title>@Jon's</title> </head> <body> <form id="form1" runat="server"> <h1>@Jon's <img src="images/sofa.jpg" alt="logo"/> </h1 > <div style="float:left;width:122px"> <p style="width: 122px; height: 663px; margin-top: 0px; margin-right: 0px;"> <a href="About.aspx">About me</a> <br /> <a href="Diary.aspx">My diary</a> <br /> <a href="Articles.aspx">Articles</a> <br /> <a href="Bookmarks.aspx">My bookmarks</a> <br /> <a href="Promotions.aspx">Promotions</a> <br /> <a href="Resume.aspx">My resume</a> <br /> <a href="Warez.aspx">Filesharing</a> <br /> </p> </div> <div> <asp:FormView ID="Envelope" runat="server" DataSourceID="SqlDataSource1" AllowPaging="True"> <HeaderTemplate> </HeaderTemplate> <EditItemTemplate> Timestamp: <asp:TextBox ID="TimestampTextBox" runat="server" Text='<%# Bind("Timestamp") %>' /> <br /> Subject: <asp:TextBox ID="SubjectTextBox" runat="server" Text='<%# Bind("Subject") %>' /> <br /> EntryText: <asp:TextBox ID="EntryTextTextBox" runat="server" Text='<%# Bind("EntryText") %>' /> <br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" /> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> <asp:Button ID="Edit" runat="server" Text="Edit" CommandName="edit" /> <br /> <asp:Button ID="New" runat="server" Text="New" CommandName="new" /> <br /> </EditItemTemplate> <InsertItemTemplate> Timestamp: <asp:TextBox ID="TimestampTextBox" runat="server" Text='<%# Bind("Timestamp") %>' /> <br /> Subject: <asp:TextBox ID="SubjectTextBox" runat="server" Text='<%# Bind("Subject") %>' /> <br /> EntryText: <asp:TextBox ID="EntryTextTextBox" runat="server" Text='<%# Bind("EntryText") %>' /> <br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" OnClick="InsertButton_Click" /> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" /> </InsertItemTemplate> <ItemTemplate> Timestamp: <asp:Label ID="TimestampLabel" runat="server" Text='<%# Bind("Timestamp") %>' /> <br /> Subject: <asp:Label ID="SubjectLabel" runat="server" Text='<%# Bind("Subject") %>' /> <br /> EntryText: <asp:Label ID="EntryTextLabel" runat="server" Text='<%# Bind("EntryText") %>' /> <br /> </ItemTemplate> </asp:FormView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:couch_dbConnectionString %>" SelectCommand="SELECT [Timestamp], [Subject], [EntryText] FROM [Article]" UpdateCommand="UPDATE [Article] SET [Timestamp] = @Timestamp, [Subject] = @Subject, [EntryText] = @EntryText" InsertCommand="INSERT INTO [Article] ([EntryID], [Timestamp], [Subject], [EntryText]) VALUES @EntryID, @Timestamp, @Subject, [EntryText]"> </asp:SqlDataSource> </div> </form> </body> </html>
Статьи.aspx-файл.в CS
using System; using System.Collections; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web.Configuration; public partial class Articles : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Title = "Jon's Couch"; } protected delegate EventHandler InsertButton_Click (object sender, FormViewCommandEventArgs e); InsertButton_Click += new System.EventHandler(this.InsertButton_Click); protected void InsertButton_Click(object sender, FormViewCommandEventArgs e) { if (e.CommandName == "new") { Envelope.DefaultMode = FormViewMode.Insert; } } }
:смущенный:
koool.kabeer
мне кажется, вы пробуете что-то новое....
jon-80
Каков правильный путь?
koool.kabeer
каково ваше фактическое требование?
Member 13928033
не сработало