<asp:GridView  ID="gvGuquanrongzi" runat="server" AutoGenerateColumns="False" 
                                CaptionAlign="Top" Height="206px" Width="475px" RowStyle-Height="30" >
                                <Columns>
                                    <asp:HyperLinkField DataTextField="Mingcheng" HeaderText="项目名称" >
                                    <HeaderStyle Height="26px" Width="214px" />
                                    <ItemStyle Height="30px" Width="214px" />
                                    </asp:HyperLinkField>
                                    <asp:BoundField DataField="Qiyemingcheng" HeaderText="公司简称" >
                                    <HeaderStyle Height="26px" Width="55px" />
                                    <ItemStyle Height="30px" Width="214px" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Code_name" HeaderText="所属行业" >
                                    <HeaderStyle Height="26px" Width="56px" />
                                    <ItemStyle Height="30px" Width="214px" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Rongziedu" HeaderText="融资金额" >
                                    <HeaderStyle Height="26px" Width="57px" />
                                    <ItemStyle Height="30px" Width="214px" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="Faburiqi" HeaderText="申请日期" >
                                    <HeaderStyle Height="26px" Width="75px" />
                                    <ItemStyle Height="30px" Width="214px" />
                                    </asp:BoundField>
                                </Columns>
                            </asp:GridView>
上面是我gridview 的代码,我想把行高 列宽 固定死,怎么实现  gridview不会随数据的长短二变化,要怎么实现,是否用datalist比较好?没用过,请教大家

解决方案 »

  1.   

    行高 列宽 固定死,用css控制就可以了。
      

  2.   

    <ItemStyle BorderWidth="1" width="50px" Height="50px" /> 
    css控制
      

  3.   


    <dx:GridViewDataTextColumn FieldName="Code" VisibleIndex="1" 
                        ShowInCustomizationForm="True" Width="200px">
      

  4.   

    后台Page_load事件也可以设置..
    例如:this.GridView1.HeaderRow.Cells[0].Width = 500;
      

  5.   

    我自己给怎错了,原来我把height给固定死了,所以表面看起来样式发生了变化