How do I say "did you see what happened?' For example, if I turn a street corner and find there is some kind of situation, for example a crashed car or whatever, and I want to ask someone nearby if they saw what happened, what should I say?

Is it 你看到发生了什么事吗？or are there any better ways to express this?
Your sentence along with others in answers are all correct. 
The closest idiomatic one I can think of is 你刚才看到这里出什么事了(did you see what happen here just now). In practice, it can be shortened as: 这里出什么事了? or 出什么事了?.