출처: http://csdotnetcode.blogspot.ca/2007/01/how-to-set-multiple-datakeynames-in.html

//To retrieve the values from a DataKeyNames collection,
        //you can use "Key Names" or "index"


        //Get the values with key names
        string productId = GridView1.DataKeys[e.RowIndex].Values["ProductID"].ToString();
        string orderId = GridView1.DataKeys[e.RowIndex].Values["OrderID"].ToString();

        //Or

        //Get the values with index
        string productId = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
        string orderId = GridView1.DataKeys[e.RowIndex].Values[1].ToString();

위와 같이 사용하면 된다. 이걸 몰라서 삽질..ㅡㅡ;;

 

Posted by 노을지기