First, 45 is the total number of students. So you have to add the ratio: 2+3=5. Since you are finding the number of sixth graders, you need to use the ratio 2.
Sixth graders : All = x : 45
2 : 5 = x : 45
You could change this to fractions and solve it.
2/5 = x/45
x = 18
So there are 18 sixth graders.