What is the difference between following code

62 Views Asked by At
var id = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Value);
var id2 = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Values);

if i use second code as

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

, could i assign second DataKey to variable id2

Thanks for all interests

1

There are 1 best solutions below

0
On BEST ANSWER

DataKey Properties

Value

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

Values

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

So you can assign

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