Can I put keyboards in the dishwasher?
I have used this technique to clean a dozen keyboards over the years, including several from my work that were "dingy" and needed a "facelift". The first time I heard of it was from an EE who said the method was fairly similar to the rinse baths used to clean circuit boards (remember, this was two decades ago). The detergent you use does a fairly nice job of scouring the plastics, and minimizes any corrosion (which is how your flatware doesn't turn into rust). Try to use straight granular detergent, and not a gel-pack or pillow-pack, as newer "tabs" can introduce other chemical agents that are less desirable. If you are concerned about electrical contacts, first try without any detergent at all.
The trick to doing this is to look at the "style" and "type" of keyboard in use. As keyboards have become more sophisticated, there's more elements that can potentially have trouble. Old keyboards tend to be fairly mechanical beasts, with lots of contact switches and metal or plastic springs. These are the best candidates for a wash. Some keyboards, however, are not suitable for this - they either have parts that will not survive a wash intact (leatherette palm rests on a Microsoft Ergonomic 4000) or have embedded electronics that can trap water (LCD displays recessed behind a panel on gaming keyboards). In each case, look at the construction of the keyboard before proceeding, and keep in mind that it may not survive intact. If you're still willing, read on.
The easiest way to do this is to place the keyboard in the top tray, key-side-down, so that the water/detergent mix will "spray up" into the keys themselves. This also helps a bit with drainage when you finally remove the keyboard. Also important is that you disable any "heated-dry cycle" that the dishwasher may have, as some have heating elements in the top and may cause damage or melted plastic. If this is not possible, consider placing it in the middle of the bottom rack, in such a way that the keyboard is away from any heating elements, and preferably suspended slightly higher than the base of the bottom rack (maybe perched on something else).
Once the wash cycle has completed, remove the keyboard and place it on a towel in such a way that it is on-edge and tilted key-side-down, so that any residual water can work its way down through gravity. Let the keyboard remain in this position for a minimum of two days. After two days, pick the keyboard up and examine it - if you see any residual water all, let it sit for another two days, and so on. The point of this is to ensure that the keyboard will air-dry completely. If you have any doubts or concerns at all, leave the keyboard like this for a week to ensure that it has throughly air-dried.
Of course, the final test is to see if the keyboard works. Unfortunately, this means plugging it in. If at all possible, see if you can use an older (disposable?) machine to accomplish this. Although most machines will not be harmed by this, better safe than sorry. After you plug it in, be sure to test every key switch on the keyboard by stroking each row of keys with your finger. A text editor is a quick, easy way to check this.
I once purchased (a long time ago) an NCD X terminal. The terminal had a fairly standard-looking keyboard, but it had one problem - someone appeared to have split 7up on several of the keys, making them stick and slide slowly (the E wouldn't move at all if I recall). After using the wash'n'dry method, I was able to get all but the E key to move freely. The E key "crunched" (the sugar had re-crystallized) but still was sticky. A second wash later it moved freely, and it never malfunctioned afterwards.
I tried it, failed
I tried it on a Mac keyboard. It got sparkling clean but didn't work after that. I didn't use a hair dryer as others have suggested, I just let it sit upside down under my desk.
On a second keyboard I popped off the keys and put them in one of those little bags for washing small things. That worked very nicely for me.
Keyboards tend to have mylar sheets in them, and these are very hard to get dry again. I have successfully cleaned keyboards by dismantling them, taking out the circuit boards and mylar and just scrubbing the plastic case in the sink. However this is a lot of work and these days I would just buy another keyboard.