<div id="divDataGrid">
     <cc1:IOVGridView ID="dgDetail"  runat="server" mlm="true" Style="position: static;
        height: 20px" AutoGenerateColumns="False" ShowFooter="True" EnableClientSelect="False"
        EnableSequence="True" VirtualItemCount="1"  KeepedFootCells="" AllowCustomPaging="False" EnableControlDeleteItem="False" OnRowDataBound="dgDetail_RowDataBound" DataKeyNames="DetailId" OnRowCreated="dgDetail_RowCreated"> 
         <Columns>     
             <asp:BoundField HeaderText="序号" FooterText="合计"> 
                 <ItemStyle width="10px" /> 
             </asp:BoundField> 
             <asp:BoundField HeaderText="DetaliId"  DataField="DetailId" /> 
             
           <asp:TemplateField HeaderText="选择"> 
                    <HeaderTemplate>
                      <asp:CheckBox runat="Server" Text="选择" ID="chkHead" /> 
                    
</HeaderTemplate> 
              <itemtemplate>
                 <asp:CheckBox runat="server" ID="chkDgEffective" Checked = '<%# Eval("checkchoose").ToString() == "1"?true:false %>' > </asp:CheckBox> 
                
</itemtemplate> 
                <ItemStyle width="30px" /> 
          </asp:TemplateField> 
          
            <asp:TemplateField HeaderText="销售合同号">
                 <itemtemplate>
<asp:TextBox id="txtConteactNo" runat="server"  MaxLength="30" EnableTheming="False" Enabled='<%# IsNew == 1?false:(Eval("IsAdd").ToString() == "0"?false:true) %>' text='<%# Bind("ContractNumber") %>' __designer:wfdid="w3"></asp:TextBox> 
</itemtemplate> 
            <ItemStyle Wrap="True" width="60px" />         
             </asp:TemplateField> 
                
             <asp:TemplateField HeaderText="采购合同号" > 
                 <itemtemplate>
<asp:TextBox id="txtBuyContract" runat="server"  Text='<%# Bind("BuyContractNumber") %>' MaxLength="30" EnableTheming="False" Enabled='<%# IsNew == 1?false:(Eval("IsAdd").ToString() == "0"?false:true) %>' __designer:wfdid="w4"></asp:TextBox> 
</itemtemplate> 
             <ItemStyle width="80px" /> 
             </asp:TemplateField> 
            
             <asp:TemplateField HeaderText="物料代码"> 
                 <itemtemplate>
<asp:TextBox id="txtItemNo" runat="server" Width="100%" Text='<%# Bind("ItemCode") %>' MaxLength="30" EnableTheming="False" Enabled='<%# IsNew == 1?false:(Eval("IsAdd").ToString() == "0"?false:true) %>' __designer:wfdid="w5"> </asp:TextBox> <asp:HiddenField id="ttItemId" runat="server" __designer:wfdid="w6" Value='<%# Bind("ItemId") %>'> </asp:HiddenField> 
</itemtemplate> 
                 <ItemStyle width="80px" />
             </asp:TemplateField> 
            
             <asp:TemplateField HeaderText="物料名称">               
                 <itemtemplate>
                     <asp:TextBox runat="server" Width="100%" Text = '<%# Bind("ItemName") %>' style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" Readonly="true" MaxLength="30" ID="txtItemName" CssClass="TextboxNone" EnableTheming="False"> </asp:TextBox> 
                  
</itemtemplate> 
                <ItemStyle width="80px" />
             </asp:TemplateField>    
            
            <asp:TemplateField HeaderText="单位">               
                 <itemtemplate>
                    <asp:TextBox runat="server" Width="100%" Text = '<%# Bind("Unit") %>' style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" Readonly="true" MaxLength="30" ID="txtUnit" CssClass="TextboxNone" EnableTheming="False"> </asp:TextBox> 
                
</itemtemplate> 
                 <ItemStyle width="30px" /> 
             </asp:TemplateField> 
             
             <asp:TemplateField HeaderText="物料条码">               
                 <itemtemplate>
                    <asp:TextBox id="txtBarcode" runat="server" Enabled ='<%# IsNew == 1?false:(Eval("IsAdd").ToString() == "0"?false:true) %>' Width="100%" Text = '<%# Bind("ItemBarcode") %>'> </asp:TextBox>  
                 
</itemtemplate> 
                 <ItemStyle width="90px" />
             </asp:TemplateField>    
            
              <asp:TemplateField HeaderText="应接收数量">  
                 <FooterTemplate>
                     <asp:Label runat="server" ID="lblMustQtySum" > </asp:Label> 
                    
</FooterTemplate> 
                 <itemtemplate>
                     <asp:TextBox runat="server" Width="100%" Enabled ='<%# IsNew == 1?false:(Eval("IsAdd").ToString() == "0"?false:true) %>' MaxLength="30" Text = '<%# Bind("PlanQty") %>' ID="txtReiceiveQty" EnableTheming="False"> </asp:TextBox> 
                
</itemtemplate> 
                 <ItemStyle width="30px" /> 
             </asp:TemplateField>               <asp:TemplateField HeaderText="已入库数量"> 
                <FooterTemplate>
                         <asp:Label runat="server" ID="lblAreadyQtySum" > </asp:Label> 
                
</FooterTemplate>  
                 <itemtemplate>
                    <asp:TextBox runat="server" Text='<%# Bind("AlreadyQty") %>' ID="txtStockQty" EnableTheming="False" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" CssClass="TextboxNone" Width="100%" Readonly="true"> </asp:TextBox> 
                
</itemtemplate> 
                 <ItemStyle width="30px" /> 
                 </asp:TemplateField> 
            
             <asp:TemplateField HeaderText="入库数量">    
                <FooterTemplate>
                                     <asp:Label runat="server" ID="lblRealQtySum" > </asp:Label> 
                
</FooterTemplate>    
                 <itemtemplate>
                    <asp:TextBox runat="server" Width="100%" Text = '<%# Bind("ActualQty") %>' MaxLength="30"  ID="txtSteockQty" EnableTheming="False"> </asp:TextBox> 
                
</itemtemplate> 
                 <ItemStyle width="30px" /> 
             </asp:TemplateField>   
            
             <asp:TemplateField HeaderText="入库库位" >     
                  <itemtemplate>
                  <iovcc:IOVDropDownList runat="server" KeepBlankItem="True" ID="ddlDgStock"  Width="100%"> </IOVcc:IOVDropDownList> 
                    
</itemtemplate> 
             <ItemStyle width="100px" />             
             </asp:TemplateField>                 <asp:TemplateField HeaderText="入库检验结果&lt;span class='redStar'&gt;*&lt;/span&gt;" >     
                  <itemtemplate>
                 <IOVcc:IOVDropDownList id="ddlDgLocation" runat="server" Text = '<%# Bind("CheckStatus") %>' KeepBlankItem="True" > <asp:ListItem Value="1"> OK </asp:ListItem> 
                 <asp:ListItem Value="0"> NG </asp:ListItem> 
                 </IOVcc:IOVDropDownList>  
                
</itemtemplate> 
             <ItemStyle width="20px" />             
             </asp:TemplateField>                          
           
             <asp:TemplateField HeaderText="入库检验记录">               
                 <itemtemplate>
                    <asp:TextBox runat="server" Width="100%" MaxLength="30" Text = '<%# Bind("CheckComment") %>' ID="txtRecordNo" EnableTheming="False"> </asp:TextBox> 
                
</itemtemplate> 
                 <ItemStyle width="50px" /> 
             </asp:TemplateField>     
                      
              <asp:TemplateField HeaderText="验收结果">               
                 <itemtemplate>
                     <asp:TextBox runat="server"  Width="100%" Text = '<%# Eval("ValiResult").ToString()=="0"?"NG":"OK" %>'  Readonly="true" MaxLength="50" ID="txtCheckResult" EnableTheming="False" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" CssClass="TextboxNone"> </asp:TextBox> 
                
</itemtemplate> 
                 <ItemStyle width="20px" /> 
             </asp:TemplateField> 
            
              <asp:TemplateField HeaderText="验收记录">      
                 <itemtemplate>
                     <asp:TextBox runat="server" Width="100%" Text = '<%# Bind("ValiRecord") %>' Readonly="true" MaxLength="50" ID="txtCheckRecord" EnableTheming="False" style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" CssClass="TextboxNone"> </asp:TextBox> 
                
</itemtemplate> 
               <ItemStyle Width="30px" wrap="True" />          
             </asp:TemplateField>  
             <asp:BoundField HeaderText="IsAdd"  DataField="IsAdd" />           
         </Columns> 
     </cc1:IOVGridView> 
     </div>我的列宽显示并没有按设置中的那样显示. 后面几列特别窄.
请高手帮忙看看.

解决方案 »

  1.   

    <ItemStyle width="20px" /> 
    20像素,能有多宽???
      

  2.   

    那看我的入库库位,有100px.也那么窄. 20px也可以写得下三个数字
      

  3.   

    都有设置列宽的. 请仔细看一下:
    <ItemStyle Width="30px" wrap="True" /> 
      

  4.   

    看到.
    像验证结果20px,
    20px只够显示一个汉字的.
      

  5.   

    <cc1:IOVGridView ID="dgDetail"  runat="server" mlm="true" Style="position: static;width:100%;
            height: 20px" 
    也是一样的效果. 原本就是100%的,
      

  6.   

    我就怀疑他用了100%,才会出现这种情况.
    检查一下html的table看有没有100%,有的话去掉
      

  7.   

    <div id="divDataGrid">
         <div>
    <table class="dataGrid" cellspacing="1" rules="all" mlm="true" border="0" id="ctl01_CP_dgDetail" style="border-width:0px;position: static;
            height: 20px">
    <tr class="dataGridHeader">


    这是显示出来后,查看源文件中的表格信息
      

  8.   

    可能是总长度和你所设置的总长度不匹配造成的,建议使用相对宽度,例如:Width:20%~~~
      

  9.   

    看着有点乱,就不仔细看了,建议检查一下是不是table总宽度和每一列宽度的集合加起来有冲突。另外推荐把表格样式集中定义到一个css里面,方便修改,也增加可读性。
      

  10.   

    点下整个GRIDVIEW,将全局宽度设为空。
      

  11.   

    在Load事件中增加:   Me.GridView1.Attributes.Add("style", "word-break:keep-all;word-wrap:normal")
     自动列宽