'save_Click'没有重载匹配委托'System.EventHandler'

时间:2012-10-08 15:25:18

标签: c# asp.net

我有一个asp:按钮<asp:Button runat="server" ID="save_players" Text="Save Changes" OnClick="save_Click" />想要运行以下代码,但是收到错误“'save_Click'没有重载与委托'System.EventHandler'匹配。”

我重新判断这是因为方法签名与EventHandler委托不匹配 - 但我不知道如何修复它。请帮忙吗? 这是我的C#方法:

protected void save_Click(object sender, ListViewCommandEventArgs e)
{
    foreach (ListViewItem item in ListViewAddPlayers.Items)
    {
        if (item.ItemType == ListViewItemType.DataItem)
        {
            string tournyName = (string)(Session["TournyName"]);
            Label gameNumber = (Label)e.Item.FindControl("lblGame");
            TextBox txtPlayer1 = (TextBox)e.Item.FindControl("txtPlayer1");
            TextBox txtPlayer2 = (TextBox)e.Item.FindControl("txtPlayer2");

            string updateCommand = "//QUERY HERE//";
            SqlDataSource2.UpdateCommand = updateCommand;
        }
    }

    Server.Transfer("tourney-standings.aspx?name=" + (string)(Session["TournyName"]));
}

1 个答案:

答案 0 :(得分:4)

应该是 protected void save_Click(object sender, EventArgs e)

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.click.aspx