首页 新闻 会员 周边

gridview我自定了列宽 但是在IE上,却是 列宽是平分的

0
悬赏园豆:5 [已解决问题] 解决于 2012-04-01 19:15

部分代码如下:
<asp:GridView ID="GridView1" runat="server" Width="5800px"  
  AutoGenerateColumns="False"  
  onselectedindexchanged="GridView1_SelectedIndexChanged">
  <Columns>
  <asp:CommandField ShowSelectButton="True">
  <ItemStyle Width="40px" />
  </asp:CommandField>
  <asp:BoundField DataField="no" HeaderText="工号">
  <ItemStyle Width="60px" />
  </asp:BoundField>
  <asp:BoundField DataField="ha01" HeaderText="姓名" >
  <ItemStyle Width="60px" />
  </asp:BoundField>
  <asp:BoundField DataField="ha02" HeaderText="姓别" >
  <ItemStyle Width="60px" />
  </asp:BoundField>
  <asp:BoundField DataField="ha03" HeaderText="部门" >
  <ItemStyle Width="60px" />
  </asp:BoundField>
  <asp:BoundField DataField="ha04" HeaderText="班组车间" >
  <ItemStyle Width="60px" />
  </asp:BoundField>   
  <asp:BoundField DataField="ha06" HeaderText="学历" >
  <ItemStyle Width="60px" />
  </asp:BoundField>
  <asp:BoundField DataField="ha07" HeaderText="民族" >
  <ItemStyle Width="60px" />
  </asp:BoundField>
 <asp:BoundField DataField="ha19" HeaderText="备注" >
  <ItemStyle Width="150px" />
  </asp:BoundField> -------
在VS2008 上显示,列宽分布是按照width属性的,但在IE上却不是这样子了,好奇怪,我已经设了AutoGeneratecolumns属性等于false,请高人的指点指点

 

我感觉源文件都是有宽度变化的,但是呈现出来的却没有宽度变化,是不是字段太多了
源文件如下:
style="width:60px;">初中</td><td style="width:60px;">&nbsp;</td><td style="width:60px;">&nbsp;</td><td style="width:70px;">&nbsp;</td><td style="width:60px;">&nbsp;</td><td style="width:60px;">&nbsp;</td><td style="width:60px;">&nbsp;</td><td style="width:60px;">&nbsp;</td><td style="width:60px;">13407048961</td><td style="width:70px;">&nbsp;</td><td style="width:60px;">362531197812273627</td><td style="width:70px;">1978-12-1 0:00:00</td><td style="width:250px;">江西省抚州市东乡县邓家乡松湖村下园组12号</td><td style="width:70px;">&nbsp;</td><td

zhengyingcan的主页 zhengyingcan | 初学一级 | 园豆:12
提问于:2012-03-02 20:27
< >
分享
最佳答案
0

和table的布局方式也有关系,css:

自动布局,根据内容大小:

{

  table-layout:auto;

}

固定布局,根据设置的宽高:

{

  table-layout:fixed;

}

收获园豆:2
OOLi | 初学一级 |园豆:163 | 2012-03-05 12:51
其他回答(4)
0

可以试一下gridview中的column属性ItemStyle-Width和ItemStyle-Hight可以固定其宽度及高度

KivenRo | 园豆:1734 (小虾三级) | 2012-03-02 22:19

有没有列子呀

支持(0) 反对(0) zhengyingcan | 园豆:12 (初学一级) | 2012-03-03 07:36

<div >         <asp:Panel runat="server" ScrollBars="Both" BorderColor="Blue"             Border BorderWidth="1px" Width="51%" Height="72px">             <asp:GridView runat="server" AutoGenerateColumns="False"                 Height="62px" Width="499px">                 <Columns>                     <asp:BoundField HeaderText="工号" ItemStyle-Width="40px"   ItemStyle-Height="20px">                         <ItemStyle Width="40px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="姓名" ItemStyle-Width="60px" >                         <ItemStyle Width="60px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="姓别" ItemStyle-Width="60px" >                         <ItemStyle Width="60px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="部门" ItemStyle-Width="60px" >                         <ItemStyle Width="60px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="班组车间" ItemStyle-Width="110px" >                         <ItemStyle Width="60px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="学历" ItemStyle-Width="90px" >                         <ItemStyle Width="40px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="民族" ItemStyle-Width="110px" >                         <ItemStyle Width="60px" />                     </asp:BoundField>                     <asp:BoundField HeaderText="备注" ItemStyle-Width="200px" >                                           <ItemStyle Width="150px" />                     </asp:BoundField>                 </Columns>                           </asp:GridView>         </asp:Panel>     </div>

可根据情况调整。。。

支持(0) 反对(0) KivenRo | 园豆:1734 (小虾三级) | 2012-03-03 07:58
0

你把标题也设置一下宽度。

悟行 | 园豆:12559 (专家六级) | 2012-03-02 22:48
0

<asp:GridView runat="server" Width="5800px" 

Width="5800px"  这么大?

收获园豆:1
竹子青青 | 园豆:214 (菜鸟二级) | 2012-03-02 23:00
0

看样式的执行顺序...貌似<ItemStyle Width="150px" />要加style="width:150px"

收获园豆:2
Snail的梦 | 园豆:278 (菜鸟二级) | 2012-03-08 11:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册