Try one of these two items first.
1. plug in an external monitor using a mini-vga to vga adapter
2. boot to a CD (OS disc, tech tools, etc...)
if the external monitor shows everything ok and the one in the iMac shows nothing still, then you might have a logic board issue.
If you boot to a CD and everything works fine, then you have a corrupted operating system or a corrupted partition.
For a corrupted Os, perform an Archive and Install to not loose any of your data, or back it up (target disk mode with another Mac is great for this) and reinstall.
If the harddrive is not detectable in the instaler, then the partition is corrupted. Try to fix it using Disk Utility or another tool (tech tools pro works for this, as well as Disk Warrior or other such software). This might repair it completely for you, or you might have to run a repair of the OS (archive and install). Worse case senerio, you lost all your data and you have to reinstall from scratch.