我在div中有一个gridview,如下所示:
<div id="divPopUpFiles" runat="server" style="background-color: White; width: 800px;
height: 410px; position: absolute; border-color: Black; border-style: groove;
border-width: thin; display: none; z-index: 10001;">
<asp:UpdatePanel ID="PopUpPanel" runat="server" Visible="false" UpdateMode="Conditional" ChildrenAsTriggers="true">
<Triggers>
<asp:PostBackTrigger ControlID="btnOk"/>
</Triggers>
<ContentTemplate>
<asp:Label ID="lblModifiedFilesMessage" runat="server" />
<asp:GridView ID="gvPopUpModifiedFiles" runat="server" AutoGenerateColumns="False"
CssClass="dataTable" ShowHeaderWhenEmpty="True" style="overflow: auto; width: 800px; max-height: 200px;">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkFileSelect" runat="server" Checked="true" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="FileName" DataField="FileName" />
</Columns>
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
</asp:GridView>
<asp:Button ID="btnOk" Text="OK" runat="server" Font-Bold="true" onclick="btnOk_Click" /><br />
</ContentTemplate>
</asp:UpdatePanel>
</div>
我使用了溢出:auto仍然无法使我的网格可滚动
答案 0 :(得分:0)
使用此代码。
<div style="overflow: auto; width: 800px; max-height: 200px;">
<asp:GridView ID="gvPopUpModifiedFiles" runat="server" AutoGenerateColumns="False"
CssClass="dataTable" ShowHeaderWhenEmpty="True" style="overflow: auto; width: 800px; max-height: 200px;">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkFileSelect" runat="server" Checked="true" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="FileName" DataField="FileName" />
</Columns>
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" />
</asp:GridView>
</div>