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
感谢所有人的兴趣
答案 0 :(得分: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]);