When I first started playing, I had much of the same problem as you. In fact, for the first month, I played every last partial wrong and I sounded terrible. However, I started going to the lowest partial I could hit (middlelow C). I counted up from there. I had to do this before every piece for a while to "find my place". After that, I knew by listening whether I hit the right partial or not. However, although I could not yet always hit the right partial the first time, I did know if I hit the right one.
However, playing a brass instrument is as much mental as it is physical. You must know and be envisioning in your head what you are going to play in order to play it right. This came easier first with the lower partials and eventually with the upper partials. I would categorize my progress into four steps:
Counting up from middlelow C
Knowing if I hit the right partial or not
Being able to hit any note in the low to middle register
Being able to hit any note in the upper register
Each of these took a while. It will vary by the player, but it took me a month or two to develop my ear and to know if I struck the right note. Being able to hit any note took much longer. Most of the time was spent working on the upper register, however. It takes a while, but developing one's ear and being able to envision what you are about to play in your mind are the two most important things you'll need.
I achieved the first by counting. I would count up to a partial. Let's say E. When I sounded it, I would try to remember it and envision it. I would then play a few bars of some other piece and come back to it. I would envision the E, and hit as close as I could. If I could not tell if I hit it, I counted down the partials until I reached middlelow C. If you have a tuner, you can just take a look at that to see if you hit the right one, but I prefer counting partials. By doing this every time I practiced for a while, I not only built up my range, but I also developed the ability to hit any partial in my comfortable range (about to the C two octaves above middlehigh C at the time).
The upper register uses the same concept as the middle register. The only difference is that the upper register takes more time to master. If the piece you're working on has multiple trumpet parts, play the first (or solo if there is one) trumpet part. If you can't play it all, just play the parts you are able to play for now. This allows you to get a feel for the rhythm, and the pitch. When you're comfortable with that, Try playing the second trumpet part. Typically, it's more harmony and more repetition of notes. Next, try playing it up a step. If its in F Major, move it up half a step and play it in F# Major. This will firstly, help you with transposition. Secondly, (and more importantly) you'l learn to envision what you are going to play and play it. Keep moving it up a step until you reach the top of your range. This exercise helps with many areas of your playing, but here focus on hitting the right notes just by envisioning them. It will come with practice.
This will not come like turning a light bulb on. It takes time, dedication, and focus. However, if you can envision what you want to hit, and try to hit that partial, you'll eventually get it.