本文介绍了带有滚动条和asp.net中的按钮的datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望有一个带有
的gridview
1)滚动条
2)向上按钮-滚动条应向上移动
3)向下按钮-滚动条应向下移动
4)显示记录总数的标签
我无法获得上述所有功能,请回复
I want that there should be a gridview with
1) Scrollbar
2) Up button - so that scrollbar should move up
3) down button- so that scrollbar should move down
4) A label where the total number of records are shown
I am not able to get all the above mentioned features please reply
推荐答案
<div style="vertical-align top; height: 152px; overflow:auto;width:800px;">
<asp:GridView ID="myGridView" runat="server" AllowPaging="True" AllowSorting="True" OnRowCreated="myGridView_RowCreated">
</asp:GridView>
</div>
2.如果使用Panel
2. If you use Panel
<asp:Panel ID="myGridViewPanel" runat="server" ScrollBars="Vertical">
<asp:GridView ID="myGridView" runat="server" AllowPaging="True" AllowSorting="True" OnRowCreated="myGridView_RowCreated">
</asp:GridView>
</asp:Panel>
对于qn 4.
For qn 4.
/// <summary>
/// Occurs when a row is created in the grid view control.
/// </summary>
protected void myGridView_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (myGridView.DataSource != null)
lblRecord.Text = ((IList)myGridView.DataSource).Count.ToString(); // Assuming that your GridView is binded to List collection.
}
希望对您有帮助.
I hope this will help you well.
这篇关于带有滚动条和asp.net中的按钮的datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!