asp.net  gridview 指定数据源后,如何设置列宽
如以下
  DataSet myds = datacon.getds("SELECT 责任工序, 责任人,"
        + "品名, 客户名称 FROM 质管 WHERE (责任车间 = '业务部') AND"
            + "(返工日期 BETWEEN  '" + this.Begintime.Text + "'  AND  '" + this.Endtime.Text + "' )   AND (责任人 like '%"+ this.Ywy.Text +"%')", "sms");
        this.GridView1.DataSource = myds.Tables[0];
       // this.GridView1.DataSource = ds;
        this.GridView1.DataBind(); 
       如何设置责任工序和责任人的列宽一个为200,一个为20,谢谢.

解决方案 »

  1.   

     gridview 前台BoundField的ItemStyle-Width <asp:BoundField DataField="Title" HeaderText="题目" ItemStyle-Width="200px" />
      

  2.   

    自己用table控制不就行了嘛,例如:<asp:GridView ID="gvProduct" runat="server" AutoGenerateColumns="false" Width="100%"
            AllowPaging="True" PageSize="4" OnPageIndexChanging="gvProduct_PageIndexChanging"
            PagerSettings-Mode="NextPrevious">
            <PagerSettings FirstPageText="首页" LastPageText="尾页" Mode="NextPrevious" NextPageText="下一页"
                Position="TopAndBottom" PreviousPageText="上一页" />
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <table width="100%" border="1" cellpadding="6" cellspacing="4">
                            <tr>
                                <td width="40%" rowspan="7" align="center" valign="middle">
                                    <asp:Image ID="imgImage" runat="server" ImageUrl='<%# Bind("Image") %>' />
                                </td>
                                <td width="20%">
                                    产品编号:
                                </td>
                                <td width="40%">
                                    <asp:Label ID="lblProductId" runat="server" Text='<%# Bind("ProductId") %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    产品分类:
                                </td>
                                <td>
                                    <asp:Label ID="lblCategoryId" runat="server" Text='<%# Bind("CategoryId") %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    产品名称:
                                </td>
                                <td>
                                    <asp:Label ID="lblName" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    产品价格:
                                </td>
                                <td>
                                    <asp:Label ID="lblListPrice" runat="server" Text='<%# Bind("ListPrice") %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    单位成本:
                                </td>
                                <td>
                                    <asp:Label ID="lblUnitCost" runat="server" Text='<%# Bind("UnitCost") %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    产品描述:
                                </td>
                                <td>
                                    <asp:Label ID="lblDescn" runat="server" Text='<%# Bind("Descn") %>'></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    库存:
                                </td>
                                <td>
                                    <asp:Label ID="lblQty" runat="server" Text='<%# Bind("Qty") %>'></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:HyperLinkField Text="购买" DataTextFormatString="{0:c}" DataNavigateUrlFields="ProductId"
                    DataNavigateUrlFormatString="~/ShopCart.aspx?ProductId={0}" HeaderText="放入购物车" />
            </Columns>
        </asp:GridView>
      

  3.   

    想拥有一个非常稳定、速度又快、全自助双线主机吗?
    还在犹豫什么,互通数据是你最好的选择。

    详情请访问:http://www.515dns.com 
    QQ:287895593
      

  4.   

    http://www.olcodes.com/article/html/5207.html 看看有没有你想要的
    http://www.olcodes.com/search.asp?word=GridView&m=1&searchbtn2=%BF%AA%CA%BC%CB%D1%CB%F7