gridview 按钮 获得该行

 protected void Button2_Click(object sender, EventArgs e)
        {
            GridViewRow row = ((Button)sender).Parent.Parent as GridViewRow;

         string id = GridView1.DataKeys[row.RowIndex].Value.ToString(); //获得该行主键
        }

posted @ 2012-07-22 21:17  沐雪架构师  阅读(152)  评论(0编辑  收藏  举报