gridview我自定了列宽 但是在IE上,却是 列宽是平分的
代码如下:
<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,请高人的指点指点
------解决方案-------------------- 用这种形式写
<asp:TemplateField>
<HeaderTemplate>工号</HeaderTemplate>
<ItemTemplate>
<div style=" width:60px; white-space:nowrap; overflow:hidden;" ><%#eval("no")></div>
</ItemTemplate>
</asp:TemplateField>
------解决方案--------------------你是怎么测试的啊,下面的代码在IE8,Firefox下都没有任何问题啊,看问题要看全部
HTML code
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataRow dr;
dt.Columns.Add(new System.Data.DataColumn("no", typeof(System.Int32)));
dt.Columns.Add(new System.Data.DataColumn("ha01", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("ha02", typeof(System.Double)));
dt.Columns.Add(new System.Data.DataColumn("ha03", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("ha04", typeof(System.Double)));
dt.Columns.Add(new System.Data.DataColumn("ha05", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("ha06", typeof(System.Double)));
dt.Columns.Add(new Sy