首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

gridview 取得某行的 datakey解决方案

2012-02-13 
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();          ...     } 

热点排行