Vik*_*nte 11 asp.net aspxgridview
我将GridView从工具箱拖放到Aspx页面.设计代码如下所示
<asp:GridView ID="gridview1" runat="server" style="text-align:center;width: 1327px;"
CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True"
EnableSortingAndPagingCallbacks="True" PageSize="50" AutoGenerateEditButton="True">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"
Height="12px" VerticalAlign="Bottom" Width="12px" Wrap="False" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
我在数据库中有一个名称地址列.使用以下VB.NET代码将表绑定到此网格视图
Dim ds as Data.DataSet
Dim da As New OleDbDataAdapter("select col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,Address from table, con)
da.Fill(ds)
gridviewrealestate.DataSource = ds
gridviewrealestate.DataBind()
Run Code Online (Sandbox Code Playgroud)
现在,当显示gridview时,由于地址列中存在大量信息,列彼此非常接近.我想将地址列设置为特定宽度.请帮我怎么做.
小智 12
<asp:GridView ID="GridView1" runat="server">
<HeaderStyle Width="10%" />
<RowStyle Width="10%" />
<FooterStyle Width="10%" />
<Columns>
<asp:BoundField HeaderText="Name" DataField="LastName"
HeaderStyle-Width="10%" ItemStyle-Width="10%"
FooterStyle-Width="10%" />
</Columns>
</asp:GridView>
Run Code Online (Sandbox Code Playgroud)
我知道这是一个古老的问题,但当我在寻找同一问题的解决方案时它突然出现,所以我想我会发布对我有用的东西.
<asp:BoundField DataField="Description" HeaderText="Bond Event" ItemStyle-Width="300px" />
Run Code Online (Sandbox Code Playgroud)
我使用了我的ItemStyle-Width属性BoundField ,它工作得很好我还没有任何问题.
我不需要在代码的其余部分添加任何其他内容来使其工作.
| 归档时间: |
|
| 查看次数: |
91458 次 |
| 最近记录: |