专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > ASP.NET

怎么在gridview的加入滚动条

发布时间:2011-06-22 17:12:05 文章来源:www.iduyao.cn 采编人员:星星草
如何在gridview的加入滚动条?
如何在gridview的加入滚动条?如果超高,就出现上下滚动条,如果超宽,出现左右滚动条

哪位给一个段代码?

------解决方案--------------------

------解决方案--------------------
asp:Panel ID="Panel1" runat="server" Height="185px" ScrollBars="Auto" Width="641px">
<asp:GridView ID="DG" runat="server" AllowPaging="True" AutoGenerateColumns="False" Width="865px" ForeColor="#000040">
</asp:GridView>
</asp:Panel>


.Freezing
{
position:relative ;
table-layout:fixed;
top:expression(this.offsetParent.scrollTop);
z-index: 10;
}
 
.Freezing th{text-overflow:ellipsis;overflow:hidden;white-space: nowrap;padding:2px;}

<div style="overflow-y: scroll; height: 200px;width:300px" id="dvBody">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3" OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating" OnRowCancelingEdit="GridView1_RowCancelingEdit" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" Font-Size="12px" OnRowCreated="GridView1_RowCreated" >
<FooterStyle BackColor="White" ForeColor="#000066" />
<Columns>
<asp:BoundField DataField="姓名" HeaderText="姓名" />

</Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" CssClass="ms-formlabel DataGridFixedHeader"/>
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="Freezing"/>
</asp:GridView>
</div>

gridview72例
------解决方案--------------------
外面加个div就行,让div出现滚动条
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: