How do you cook corn on the cob on BBQ?
The best way I have found is to soak the ears in husk for several hours before grilling. This lets the husk soak lots of water. Then place the corn, still in husk, on a hot grill for about 10 minutes, ~1/4 turn, 10 minutes, turn... until the husk gets brown, even burnt.

You should be able to tell when the corn is cooked by the smell. The sugars in the corn will start to caramelize and brown in the husk and it will give off a delicious caramel smell. You can check them by peeling down the husk to make sure that they are cooking well.

Times will depend on your grill and how much patience you have. In general, it is difficult to overcook. You want to watch out for drying, but that usually takes a while if you soak the ears beforehand.

Foil is a poor substitute for the natural wrapper. The husk both protects the cob from too much direct heat as well as holding water close to the cob to gently steam the kernels. And its just prettier with the browned and burnt husk, au natural.