Code<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="入库检验结果<span class='redStar'>*</span>" > <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>
我的列宽显示并没有按设置中的那样显示. 后面几列特别窄. 请高手帮忙看看.
你给 itemtemplate 里面 的 asp:TextBox 设置 宽度 ***px
别用 % 宽度
如果列表必须的显示项多,又要都显示的话,就给列直接制定xxpx吧,然后向前一个div 有滚动条,就可以了 啊。用xx%的话.它的宽度最宽也就是显示器的宽度。如果你的显示列很多的话,长度肯定超过显示区域宽,就是你的这个样子。用px吧
关注一下。