Can you please take another stab at explaining the steps to recreate your issues here?
At first read (and 2nd), it appears you are connecting your midi controller after you have your project open in Sonar. Is that correct?
Also, please detail exactly what midi and audio track routing assignments you are using when you encounter this issue.
I have never experienced your reported issue, by the way, but will certainly try to replicate your results, once you lay them out in more detail.
Thanks - trying to help :)
Bob Bone