如题!

解决方案 »

  1.   

    BoundField
    如在后台取.
    可为GridView设置DataKey
    如要取列中绑定的ID 则把 GridView的DataKey 设为ID
    在后台string id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();可以取到..也可以在模板列中...<asp:Button ID="DeleteButton" runat="server" Text="删除" CommandName="DeleteData" CommandArgument='<%#Bind("ID") %>' />
    后台        if (e.CommandName == "DeleteData")
            {
               string id=e.CommandArgument.ToString();
            }
      

  2.   

    GridView1.DataKeys[e.RowIndex].Values[0],  可以给讲讲什么意思吗?
      

  3.   

    DataKeys 实际就是设置一些隐藏字段放在GridView上。当绑定时可以通过DataKeys取出数据,当然DataKeys可以设置多个。注意:e.RowIndex > -1 才有效。