GridView 索引超出范围 的问题
string   id   =   GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString();  
索引超出范围。必须为非负值并小于集合大小。   
 但是我取GridView1.SelectedIndex的时候是正常的 
 DataKeyNames= "id "这个也设置了   
 为什么出错呢
------解决方案--------------------说不好。上下文是什么?
------解决方案--------------------SelectedIndex从0开始! 
 也说不清什么总是,不好判断!
------解决方案--------------------GridView1.SelectedIndex是不是为-1了?
------解决方案--------------------DataKeys 这个中的索引值和SelectedIndex是两回事吧
------解决方案--------------------up