1
var id = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Value);
var id2 = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Values);

如果我使用第二个代码作为

id2 = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Values[1]);

,我可以将第二个 DataKey 分配给变量 id2

感谢大家的兴趣

4

1 回答 1

1

数据键属性

价值

Gets the value of the key field at index 0 in the DataKey object.

价值观

Gets an IOrderedDictionary object that contains every key field in the DataKey 
object.

所以你可以分配

id2 = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Values[1]);
于 2014-02-20T13:01:12.500 回答