Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.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# 与DataGrid asp.net中的ItemCommand事件相关的问题_C#_Asp.net - Fatal编程技术网

C# 与DataGrid asp.net中的ItemCommand事件相关的问题

C# 与DataGrid asp.net中的ItemCommand事件相关的问题,c#,asp.net,C#,Asp.net,我有一个asp.net应用程序,在aspx页面上有DataGrid,它有一些自动生成的列: 我已将ItemCommand事件绑定到网格上,如下所示: protected void DataGrid2_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "CheckInventoryAndPrice")

我有一个asp.net应用程序,在aspx页面上有DataGrid,它有一些自动生成的列:

我已将ItemCommand事件绑定到网格上,如下所示:

 protected void DataGrid2_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            if (e.CommandName == "CheckInventoryAndPrice")
            {


                string itemMainPageLink = E2WConstants.Pages.ITEM_MAIN;
                string itemId = (DataRowView)e.Item.DataItem).Row["ItemId"].ToString();

                //Response.Redirect();
            }
        }
但我总是得到DataItem Null:那么我如何才能得到所选行的单元格值

谢谢