We propose new methodology for designing an almost ideal bandpass filter as a cascade of two piecewise uniform fiber Bragg gratings. The first grating is designed to get the desired bandpass amplitude spectrum. The second is used to flatten the group delay characteristics of the first. The parameters of the gratings are determined by using the simulated-annealing technique and the steepest-descent algorithm. At the expense of a complicated structure, we are able to obtain an almost ideal bandpass filter with a flat group delay.