Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Asp.net链接onrow命令不工作_C#_Asp.net_Gridview_Webforms - Fatal编程技术网

C# Asp.net链接onrow命令不工作

C# Asp.net链接onrow命令不工作,c#,asp.net,gridview,webforms,C#,Asp.net,Gridview,Webforms,下面给出了我的GridView id(Asp.net web应用程序) onRowCommand的我的方法 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using FirstWebForm.business_objects; namespace FirstWebF

下面给出了我的GridView id(Asp.net web应用程序)

onRowCommand的我的方法

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FirstWebForm.business_objects;

namespace FirstWebForm
{
    public partial class About : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                grid.DataSource = dataaccess.Instance.getAll();
                grid.DataBind();
            }
        }

        void ContactsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
        }

    }
}
但它遇到了一个错误


ContactsGridView\u row命令
方法更改为
public
protected
,如果要在代码隐藏中运行:

protected void ContactsGridView_RowCommand
或者将该方法放在页面上的脚本标记中,它将按原样工作

<script runat="server">

  void ContactsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
  {
   ...
  }
</script>

void ContactsGridView_row命令(对象发送方,GridViewCommandEventArgs e)
{
...
}
protected void ContactsGridView_RowCommand
<script runat="server">

  void ContactsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
  {
   ...
  }
</script>