The next time you can prepare by training at high intensity on your flat rides before going to the hills. If you can simulate the effort of climbing by pushing hard on the flats for extended time periods it may help. Once climbing, try to find a rythym, a pace that you can hold for the whole climb. If you try to keep up with someone who is just a little too fast for you, you will blow up. If you know there is one big climb comming up, try to save some energy for it. Be sure to breathe, too, not just gasp for air.