前台定义一个grid如下代码
<igtbl:ultrawebgrid id="gridCourseForIndicator" runat="server" Width="100%" Height="100%"> <DisplayLayout AllowSortingDefault="Yes" RowHeightDefault="18px" Version="2.00" SelectTypeRowDefault="Extended"SelectTypeCellDefault="Single" BorderCollapseDefault="Separate" AllowColSizingDefault="Free" CellPaddingDefault="4" RowSelectorsDefault="No" Name="gridCourseForIndicator" TableLayout="Fixed" CellClickActionDefault="RowSelect"> <AddNewBox> <Style BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="0px" ColorLeft="White"> </BorderDetails> </Style> </AddNewBox> <Pager PrevText="上一页" NextText="下一页" PageSize="16" StyleMode="CustomLabels" AllowPaging="True"> <Style BorderWidth="1px" BorderStyle="Solid" BackColor="White"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="0px" ColorLeft="White"> </BorderDetails> </Style> </Pager> <HeaderStyleDefault BorderWidth="0px" Font-Size="12px" Font-Bold="True" BorderColor="#999999" BorderStyle="Solid" HorizontalAlign="Center" ForeColor="White" BackColor="#535893" Height="18px"> <BorderDetails ColorTop="236, 236, 236" WidthLeft="1px" ColorBottom="236, 236, 236" WidthTop="1px" ColorRight="236, 236, 236" ColorLeft="236, 236, 236"> </BorderDetails> </HeaderStyleDefault> <RowSelectorStyleDefault BorderWidth="0px" BackColor="#535893"></RowSelectorStyleDefault> <FrameStyle Width="100%" BorderWidth="1px" Font-Size="12px" Font-Names="Verdana" BorderColor="#999999" BorderStyle="Solid" Height="100%"> </FrameStyle> <FooterStyleDefault BorderWidth="0px" BorderStyle="Groove" BackColor="LightGray"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="0px" ColorLeft="White"></BorderDetails> </FooterStyleDefault> <ActivationObject BorderWidth="" BorderColor="153, 153, 153"></ActivationObject> <EditCellStyleDefault Cursor="Wait" VerticalAlign="Middle" BorderWidth="1px" BorderColor="Black" BorderStyle="None"> <Padding Bottom="1px"></Padding> </EditCellStyleDefault> <SelectedRowStyleDefault Cursor="Default" BackColor="#FFF4AD"></SelectedRowStyleDefault> <RowAlternateStyleDefault BackColor="#F9F9F9"></RowAlternateStyleDefault> <RowStyleDefault VerticalAlign="Middle" BorderWidth="1px" BorderColor="#999999" BorderStyle="Solid" HorizontalAlign="Left" BackColor="White"> <Padding Left="3px"></Padding> <BorderDetails WidthLeft="0px" WidthTop="0px"></BorderDetails> </RowStyleDefault> </DisplayLayout> <Bands> <igtbl:UltraGridBand></igtbl:UltraGridBand> </Bands> </igtbl:ultrawebgrid>
这样的话,因为有FrameStyle,所以grid的高度不会自动根据grid中的内容自动伸展,定义了多高就会显示多高。
如果需要将grid的高度根据grid的内容显示,就要去掉这段代码
<FrameStyle Width="100%" BorderWidth="1px" Font-Size="12px" Font-Names="Verdana" BorderColor="#999999"BorderStyle="Solid" Height="100%">
</FrameStyle>