You can use something like a shock collar. It's not really very painful to the dog, and after two or three shocks, they usually learn to not get out of their area and will remain in it even when the collar is not attached. You may need to reinforce the behavior sporadically every few months or so, but because you do so, the time between reinforcements to grow larger and larger.
If you think about how to enter your dog to show some sort, they probably will have to go through some type of course. You can buy various accessories and create your own course to train your dog into a dog will only explore it at first.