I think the way I did this was fairly simple compared to the videos posted. It was on level 10, the one where you get the second portal gun, to enable you to fire orange portals.
In the room there's a button next to you and the portal gun is spinning and firing in different directions. You push the button to open the hatch across the room and fire a portal through it into the room beyond. Then wait for the gun to fire the orange portal next to you and jump through it. You're now in the room beyond the hatch (this is where you are going to be trapped).
When the orange portal opens directly across from the orb activator thing, fire a portal at the wall that the orb is hitting. This will activate the moving platform outside the room. Now fire a portal in the wall of the room and wait for the orange portal to open at the moving platform and jump through on to it then get the gun. It's important that you don't fire your blue portal anywhere else at this point as you want it to stay inside the room.
After getting the gun, get back on the moving platform, fire an orange portal at the wall, jump through it back into the room through the hatch and you're trapped. Like a rat.