[英]ASPxGridView rows disappear on paging and re-sorting
I linked my ASPxGridView to a datasource, but whenever the GridView needs to display more than one page of information, the GridView disappears whenever I click on the 'Next Page' arrow. 我将ASPxGridView链接到数据源,但是只要GridView需要显示多个信息页面,只要单击“下一页”箭头,GridView就会消失。 After I run the search again and populate the GridView, the second page of data is displayed.
再次运行搜索并填充GridView之后,将显示第二页数据。
This same issue happens when I try to sort by a different column or if I try to move columns around. 当我尝试按其他列排序或尝试移动列时,也会发生相同的问题。 The data on the GridView disappears only to re-appear with the data adjusted the way I wanted when I run the search again.
再次运行搜索时,GridView上的数据消失了,只是重新显示了我想要的方式调整的数据。
<dxwgv:ASPxGridView ID="commentsASPxGridView" runat="server"
AutoGenerateColumns="True" IsCallBack="False"
Width="800px" SettingsPager-PageSize="25">
<Columns>
<%-- Some data columns --%>
</Columns>
<SettingsPager PageSize="25"></SettingsPager>
</dxwgv:ASPxGridView>
My datasource for the GridView is a DataTable
object. 我的GridView数据源是一个
DataTable
对象。
The ASPxGridView was not being bound to data on every server request. 没有将ASPxGridView绑定到每个服务器请求上的数据。 The page was not handling postback and adding a handler in the
Page_Load
method like so: 该页面未处理回发,并没有在
Page_Load
方法中添加处理程序,如下所示:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
targetASPxGridView.DataBind();
}
// Rest of code
}
allows the GridView to stay visible and maintain data when being resorted or having its columns adjusted. 允许GridView在重新使用或调整其列时保持可见并维护数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.