Year old thread, rise from your grave.
I have the same issue with my desk. It has a fairly wide tray (~29") mounted to slides which attach to the bottom of the desk, and there's no way to latch them. I could replace the slides, but I can't find anywhere local that stocks them, and they're expensive to ship.
Cheap solution: Buy two metal bulldog clips (under $1 at an office supply store - measure the thickness of your tray to determine what size you'll want), and clip them onto the tray immediately in front of the fixed part of the slide.
If you want something better, I believe the installation of spring-locks (aka spring-latches) onto the slides would be the best solution. Of course this would require disassembling each slide and drilling holes for the mounting screws and the pin. These ones from
Ganter-Griff.de look slick, feature full retraction into the housing, and have latches to keep them in the opened and closed positions. I haven't priced them and I don't know whether they'll ship them internationally, if there's a minimum order quantity, etc. but if anyone looks into that let me know.