In Illustrator 10 (can't remember about earlier versions) there is the Rectangular Grid tool. Click and hold on the Line Segment tool to reveal it, then select it. Double-click it to define how many segments you need, then it's as simple as click-and-drag...
If you don't have this functionality, you can simply draw a horizontal line at the top, another at the bottom, then use the Blend Tool (NOT the gradient tool!) to create intermediate steps. Do the same with vertical lines.