GridView 行绑定时获取ID

 GridView gdw = (GridView)sender;

        if (e.Row.RowIndex != -1)
        {
            int id = (gdw.PageSize * gdw.PageIndex) + e.Row.RowIndex + 1;//(页面索引)*(页面大小)+本页的行索引+1(从0开始编号,所以加1)
            string bsh = GridView1.DataKeys[e.Row.RowIndex].Values["BSH"].ToString();

posted @ 2013-08-03 10:38  Bluze  阅读(273)  评论(0编辑  收藏  举报