vs2003的获取当前行索引的方法是: 先定义:this.DataGrid.DatakeyField="ID"; 然后:string empID=this.DataGrid.Datakeys[e.Item.ItemIndex].Tostring(); 05版DatakeyField没有了,Datakeys[e.?]这也变了,调用方法都不一样了。我看的是03版的视频,但我用的是05版的,方法完全变了,所以不会了,有明白的给写下GridView是怎么获取当前行索引的, 把上面的代码换成是GridView的方法,明白的希望能给些下,谢谢。还有就是DataGrid里面的ItemCommand和GridView里面的RowCommand一样么,代码写起来用没有区别。因为03和05我看到现在就是DataGrid和GridView有点不同,希望一起都给说下。
" 取值.this.GridView1.DataKeys[0].Values[0];
this.GridView1.DataKeys[0].Values[1];
e.Row.Cell[0].ToString()
便可。
string str = grdS1.DataKeys[intRow].Value.ToString();