2011-02-08 71 views
0

我想在tabcontainer的一个tabpanel上设置带有datagrid和图表的web应用程序。它开始没问题,但我需要将图表定位在数据网格的旁边。我读过关于使用CSS,但无法使其工作。 我加在它自己的DIV元素的单独的CSS文件对齐asp.net web应用程序的页面上的控件

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
<title></title> 
<link type="text/css" rel="stylesheet" href="defaultStyle.css"/> 

....

<asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
       AutoGenerateColumns="False" BackColor="White" BorderColor="#336666" 
       BorderStyle="Double" BorderWidth="3px" CellPadding="4" 
       DataSourceID="SqlDataSource1" GridLines="Horizontal" Height="92px" 
       Width="327px" HorizontalAlign="Right"> 
<RowStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Right" /> 
     <PagerStyle HorizontalAlign="Center" BackColor="#336666" ForeColor="White" /> 
       <Columns> 
        <asp:BoundField DataField="RecordsCount" HeaderText="RecordsCount" 
         ReadOnly="True" SortExpression="RecordsCount"/> 
        <asp:BoundField DataField="collectionDate" HeaderText="collectionDate" 
         ReadOnly="True" SortExpression="collectionDate" /> 
       </Columns> 
       <FooterStyle BackColor="White" ForeColor="#333333" /> 
       <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" /> 
       <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" /> 
      </asp:GridView> 

回答

1

将控件包裹在div中并将它们浮动到左侧。确保完成后清除浮标。

<div style="float:left;"> 
    <!-- Insert GridView --> 
</div> 
<div style="float:left;"> 
    <!-- Insert Chart Control --> 
</div> 
<div style="clear:both;" /> 
1

包装每个(网格和图)。

根据需要使用top/leftfloat css属性的样式DIV。您可能还需要获得margin才能获得所需的外观。

相关问题