gridview 取得某行的 datakey解决方案

gridview 取得某行的 datakeyGridView 中每行最后一列设有按钮,我需要在点击按钮后,得到该行的Datakey得值

gridview 取得某行的 datakey
GridView 中每行最后一列设有按钮,我需要在点击按钮后,得到该行的Datakey得值,然后触发其他操作。请教如何实现。

[解决办法]

C# code
    protected void Copy_Click(object sender, EventArgs e)     {         int index=((GridViewRow)(((Button)sender).Parent.Parent)).RowIndex;          String value= GridView1.DataKeys[index][0].Value.ToString();          ...     }