当前位置: 代码迷 >> ASP.NET >> gridview 取得某行的 datakey解决方案
  详细解决方案

gridview 取得某行的 datakey解决方案

热度:341   发布时间:2013-02-25 00:00:00.0
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();          ...     }
  相关解决方案