【发布时间】:2016-01-03 15:15:13
【问题描述】:
我对 Asp.net 很陌生。我在项目(C#)中的 asp:gridview 中使用自定义分页。我想修复我的 gridview 标题(冻结或可滚动标题,以便用户在向下滚动到行时可以看到标题)。我在互联网上阅读了不同的解决方案,但仍然无法找出解决方案。 如果有人可以指导我将非常高兴,谢谢。
以下是我的 gridview 代码:
<div style="overflow:scroll;width:1200px; height:500px;" >
<asp:GridView ID="ResultGridView" runat="server" CellPadding="4" OnRowCommand="ResultGridView_OnRowCommand" Font-Size="Small" Width="100%" ShowHeaderWhenEmpty="True" AutoGenerateColumns="False" AllowCustomPaging="True" AllowPaging="True" OnPageIndexChanging="ResultGridView_PageIndexChanging" >
<AlternatingRowStyle BackColor="White" HorizontalAlign="Left" Wrap="False"/>
<EditRowStyle BackColor="#7C6F57" CssClass="alt"/>
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" Wrap="false" />
<PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last"/>
<PagerStyle CssClass="gridViewPager" BackColor="#666666" ForeColor="White" HorizontalAlign="Left" Font-Size="Small" VerticalAlign="Middle" Wrap="False" />
<RowStyle BackColor="#E3EAEB" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:Button ID="DetailsButton" title="Click this button to edit / add bioactivity information" CssClass="bt" runat="server" CausesValidation="false" CommandName="DetailsButton" Text="Edit" CommandArgument='<%# String.Format("{0}", Eval("RowNumber")) %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RowNumber" HeaderText="Row ID" htmlencode="false" ItemStyle-CssClass="gridView_hiddencol" HeaderStyle-CssClass="gridView_hiddencol" />
<asp:BoundField DataField="Compound_ID" HeaderText="Compound ID" htmlencode="false" />
<asp:BoundField DataField="Compound_Name" HeaderText="Compound Name/Syn" ItemStyle-Wrap="false" htmlencode="false" />
<asp:BoundField DataField="Target_ID" HeaderText="Target ID" htmlencode="false" ItemStyle-Wrap="false" />
<asp:BoundField DataField="Target_Pref_Name" HeaderText="Target Pref. Name" ItemStyle-Wrap="false" htmlencode="false" /> <asp:BoundField DataField="PUBMED_ID" HeaderText="PubMed ID" htmlencode="false" ItemStyle-CssClass="gridView_hiddencol" HeaderStyle-CssClass="gridView_hiddencol"/>
</Columns>
</asp:GridView>
</div>
【问题讨论】:
-
@Buzinas - 我不知道,那里的答案是一个链接唯一的答案。如果您的答案适用于 OP,那么这个问题可能应该成为旧问题的欺骗目标。
标签: javascript c# css asp.net gridview