Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / Need assistance with Webdatagrid paging

Need assistance with Webdatagrid paging

New Discussion
Sanjay Shah
Sanjay Shah asked on Feb 3, 2020 12:56 PM

I am not able to get paging to work correctly in the webdatagrid.

I have a new blank ASP.NET project and have just a webdatagrid control.  I create a simple datatable with 1 column and 10 rows in the code-behind and set the grid's datasource to the datatable's DefaultView object in the Page_Load() method.

– PageSize = 2

– PagerMode = Numeric

– Ajax is enabled

– Auto generate columns is NOT enabled

When I run the project, the grid initially displays as expected with the 1st two rows, and the numeric pager at the bottom with 5 page link buttons.  Now, when I click on any of the pager buttons, the grid seems to refresh but still only displays the 1st two rows.  It does not display the correct rows.

Can anyone assist in figuring out why this doesn't work?

I'm including my ASPX and ASPX.CS files.

Thank you!

Sign In to post a reply

Replies

  • 0
    Martin Asenov
    Martin Asenov answered on Jan 6, 2020 2:18 PM

    Hello Sanjay,

    Thank you for posting in our community.

    I have created and attached a small sample illustrating the desired behavior.

    Please let me know if you need more information.

    4048.Sample.zip

    • 0
      Sanjay Shah
      Sanjay Shah answered on Jan 6, 2020 4:12 PM

      Thank you, will try this out and let you know ASAP.

      (By the way, forgot to mention I'm using version 2019.1 under Visual Studio 2017.)

    • 0
      Sanjay Shah
      Sanjay Shah answered on Jan 6, 2020 5:01 PM

      I was able to successfully run the test sample.  I'm using CLR4.0 controls in my project so I updated the sample accordingly.

      After comparing my test with the given sample, I found that I was binding the grid in an "if (!Postback) {}" statement which was causing the paging to not work.  This implies that the entire data must be retrieved upon every call to the page; wouldn't this cause performance issues for large amounts of data (which is why we'd be using paging in the first place)?

      Thanks

      • 0
        Martin Asenov
        Martin Asenov answered on Jan 7, 2020 8:39 AM

        Hello Sanjay,

        To prevent setting the WebDataGrid's data source on every request, you can use the Session object provided by ASP.NET:

        public DataTable GetDataSource()
        {
        	DataTable dt = new DataTable("Table");
        	if (!IsPostBack)
        	{
        		dt.Columns.Add("id"); ;
        
        		DataColumn[] PrimaryKeyColumns = new DataColumn[1];
        		PrimaryKeyColumns[0] = dt.Columns["id"];
        		dt.PrimaryKey = PrimaryKeyColumns;
        
        		for (int i = 0; i <= 10; i++)
        		{
        			dt.Rows.Add(new object[] { i });
        		}
        		Session["dtData"] = dt;
        	}
        	else
        	{
        		dt = (DataTable)Session["dtData"];
        	}
        	return dt;
        }

        Looking forward to hearing from you.

    • 0
      Ameur Mezaache
      Ameur Mezaache answered on Jan 30, 2020 7:05 PM

      Hi Martin

      I'm trying to implement custom angular infragistic grid populated from a call to an api that's has a server side paging which displays 10 records and has page next and page previous.

      Do you have a sample like that ?

      Thanks

      Ameur

      • 0
        Martin Asenov
        Martin Asenov answered on Feb 3, 2020 12:56 PM

        Hi Ameur,

        What I can suggest is to take a look at our documentation page about grid remote data operations.

        Please keep in mind that this section of the forums is about our Ultimate UI for ASP.NET toolset. In the future, please make sure that your queries are submitted in the corresponding section in our forum. This way we can address your issues more accurately.

        Thank you for using Infragistics components.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Sanjay Shah
Favorites
0
Replies
6
Created On
Feb 03, 2020
Last Post
6 years, 9 months ago

Suggested Discussions

Created by

Created on

Feb 3, 2020 12:56 PM

Last activity on

Feb 3, 2020 12:56 PM