شما ابتدا یک ایندکسر باید به صورت زیر تعریف کنید:

		public Int32[] SelectedIndexes 
{
get
{
System.Collections.ArrayList selectedIndexList = new System.Collections.ArrayList();

foreach( DataGridItem item in DataGrid1.Items )
{
Control foundControl = item.FindControl("chkHRow");
CheckBox Checkselector = foundControl as CheckBox;
RadioButton radioselector = foundControl as RadioButton;
if ( Checkselector != null && Checkselector.Checked )
{
selectedIndexList.Add( item.ItemIndex );
}
else if ( radioselector != null && radioselector.Checked )
{
selectedIndexList.Add( item.ItemIndex );
}
}
return (Int32[])selectedIndexList.ToArray (typeof( System.Int32 ) );
}
}


در کد فوق chkHRow نام همان چک باکس است...

سپس از ایندکسر فوق به صورت زیر استفاده می شود:

			foreach(int i in SelectedIndexes )
myFunc(i+1);