It depends on what the xrays are for. Some are more painful that others and the animal is easier to position if he is asleep. Most can be taken if the dog is sedated, and some can be taken awake.
If your animal is .... not friendly... or doesn't sit still well (as he/ she will have to be still while it is taken) then sedation is needed.
Depending on where you are, some countries have rules about not being in the room during xrays, so your dog would be put under GA and positioned, then the technicians leave and take the film. It depends on your area, your vet, and the type of shot needed. If location is the reason, then there is nothing to be done, and your dog will have to be put under.