Question

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. After I run the search again and populate the GridView, the second page of data is displayed.

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.

<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.

Was it helpful?

Solution

The ASPxGridView was not being bound to data on every server request. The page was not handling postback and adding a handler in the Page_Load method like so:

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top