1
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

osmanedip
  • 77
  • 3
  • 12

1 Answers1

1

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]);
Nagaraj S
  • 13,316
  • 6
  • 32
  • 53