Grid to fill remaining space

I have a page, that consists of two forms.
The upper one is buttons + +grid
The lower one is the set of different fields.
The height of the lower form is defined by the sum of heights of the components in the form.
The upper form should occupy the space, that is left by the lower one.
The grid in the upper form should occupy the space, that is left by the buttons in the upper form.
How to create layout for this ?