gpt4 book ai didi

html - Datagridview 标题高度在运行时发生变化如何解决?

转载 作者:太空宇宙 更新时间:2023-11-03 18:16:51 25 4
gpt4 key购买 nike

我在 ASP VB.net 工作,我的 Gridview 绑定(bind)了 SQL 数据源。我必须在运行时添加/删除行。问题是当网格中没有元素时,标题本身占据了网格的全高,即总高度根据行数拆分,但我需要修复标题和行高,

<asp:GridView ID="grdRequestItems" runat="server" AutoGenerateColumns="False" 
Height="76pt" Width ="871px" DataSourceID="SqlDataSource1"
style="font-size: 14pt; table-layout :fixed;"
CellPadding="1" HorizontalAlign="Center" PageSize="5" DataKeyNames="TempID" ShowHeaderWhenEmpty="True" AllowPaging="True" >

colums 属性..

<Columns>
<asp:BoundField DataField="Sno" HeaderText="Sno" SortExpression="Sno">
<HeaderStyle BackColor="#666666" ForeColor="White" Height="20px" Width="25px"
VerticalAlign="Top" Font-Names="Segoe UI" HorizontalAlign="Center"
Font-Size="14pt" />

…………

其他属性是..

   <EmptyDataRowStyle Height="20pt" VerticalAlign="Top" />
<HeaderStyle Font-Names="Segoe UI" Font-Size="14pt" Height="20px"
VerticalAlign="Top" HorizontalAlign="Center" />
<RowStyle Height="20pt" VerticalAlign="Top" Wrap="True" BackColor="#E6F2FF"
FontNames="Segoe UI" Font-Size="12pt" />
<SelectedRowStyle BackColor="White" Font-Names="Segoe UI" Font-Size="14pt" />
</asp:GridView>

谁能帮帮我?

最佳答案

从您的 GridView 定义中删除 height="76"

此外,请考虑使用 CssClass 而不是通过属性来指定您的样式。这是一个例子:http://www.etechpulse.com/2013/08/asp-gridview-css-style-sample-user.html

关于html - Datagridview 标题高度在运行时发生变化如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22625399/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com