Gets or sets the height of a zone.
Assembly: System.Web (in System.Web.dll)
Internet Explorer rendering modes can affect the height of a WebPart control and the height of the zone that contains it. Internet Explorer renders Web pages either in compatibility mode (backward compatible with previous browser versions) or in standards mode (determined by the presence of a DOCTYPE declaration in the page). For information about these modes, see the DHTML compatMode property.
When Internet Explorer renders a page in standards mode, under some circumstances it might not resize cells in tables, even when a cell's HTML markup is <td height="100%">. As a result, WebPart controls and their containing zone are rendered so that the controls do not stretch to the full height of the zone.
When Internet Explorer is in standard mode, controls do not render to stretch to their full height in the following cases:
When a zone's LayoutOrientation property is set to Vertical and you explicitly set the height on the zone. To enable controls to fill the full height of the zone, do not specify the height of a horizontally oriented zone.
When a zone's LayoutOrientation property is set to Horizontal and you do not explicitly set the height of the zone or of the contained controls. To enable controls to fill the full height of the zone, set the height of the zone or of the controls in a vertically oriented zone.
Legacy Code Example
Note that the zone's orientation is set to horizontal, and that the height of the zone and the controls within it is not set explicitly. The result is that in the WebPartZone, the shorter WebPart control does not stretch to the height of the zone upon rendering. However, if you remove the DOCTYPE declaration from the page and run the page again, the issue does not occur, because now the browser will not render the page in standards mode.Code snippet is not found. Confirm that the code snippet name 'WebParts_WebPart_Height' is correct.
To see how the workaround (described in the Remarks section) works, try adding a height attribute to the <asp:webpartzone> element, while keeping the DOCTYPE declaration in the page. You can use the following code to add the attribute to the tag:
Run the page, and now both WebPart controls stretch to fill the explicitly declared height of the zone.
You can also experiment with this code example to observe the height-related rendering issue in the other scenario, which occurs when the zone's LayoutOrientation is set to Vertical. Remove the existing LayoutOrientation attribute and its value from the <asp:webpartzone> element, which will cause the zone's orientation to revert to the default vertical orientation. Set the height attribute on the <asp:webpartzone> element to 200 pixels, as you did above, and run the page. The zone's height looks too large, and the controls are not sized proportionately to the zone's height. Now remove the height attribute and run the page again. The controls now render relative to the height of the zone.
Available since 2.0