Infragistics UltraGrid - how to add rows when scroll reaches bottom?

Chuy

I have a table with 100,000 records and i have a method (using entity framework) that retrieve 10 records, i give it how many records skip to get the next 10 records.

List<Item> GetRecords(int skip = 0);

I load the first 10 records on a list, and set it as datasource of the UltraGrid, how can i call the method to get the next 10 records and add it to the UltraGrid when the scroll reaches the bottom or is near to reach the bottom?

Sagar Dev Timilsina

I have a solution for your requirement. Hope this helps you..

First, create a windows form named "test" (say).. Add a ultraGrid in the form..

enter image description here

check the following code:

   public partial class test : Form
   {
    DataTable dtSource = new DataTable();
    int takecount = 50;
    int skipcount = 0;
    DataTable dtResult;

    // CONSTRUCTOR
    public test()
    {
        InitializeComponent();

        // Fill Dummy data here as datasource...

        dtSource.Columns.Add("SNo", typeof(int));
        dtSource.Columns.Add("Name", typeof(string));
        dtSource.Columns.Add("Address", typeof(string));
        int i = 1;
        while (i <= 500)
        {               
            dtSource.Rows.Add(new object[] { i, "Name: " + i, "Address " + i });
            i++;
        }
        dtResult = dtSource.Copy();
        dtResult.Clear();
    }

    // ON FORM LOAD FUNCTION CALL
    private void test_Load(object sender, EventArgs e)
    {            
        ultraGrid1.DataSource = dt_takeCount();
        ultraGrid1.DataBind();


    }

    private DataTable dt_takeCount()
    {            
        if (dtSource.Rows.Count - skipcount <= takecount)
        {
            takecount = dtSource.Rows.Count - skipcount;
        }
        foreach (var item in dtSource.AsEnumerable().Skip(skipcount).Take(takecount))
        {
            dtResult.Rows.Add(new object[] { item.Field<int>("SNo"), item.Field<string>("Name"), item.Field<string>("Address") });
        }
        if (dtSource.Rows.Count - skipcount >= takecount)
        {
            skipcount += takecount;               
        }            
        return dtResult;
    }

    // EVENT FIRED WHEN ON AFTERROWREGIONSCROLL
    private void ultraGrid1_AfterRowRegionScroll(object sender, Infragistics.Win.UltraWinGrid.RowScrollRegionEventArgs e)
    {
        int _pos = e.RowScrollRegion.ScrollPosition;
        if (ultraGrid1.Rows.Count - _pos < takecount)
        {
            dt_takeCount();
        }           
    }        
}

Above code is all that works.. --> "ultraGrid1_AfterRowRegionScroll" function is "AfterRowRegionScroll" event function

--> But be sure that when you choose "takecount", it generates scrollbar, --> when you run above code... the row will be updated by 50 when you scroll,, till 500th row.. because it is the last row.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Infragistics UltraGrid - how to add rows when scroll reaches bottom?

From Dev

Infragistics UltraGrid rows displayed from bottom to top

From Dev

How to add columns to Infragistics UltraGrid without using designer

From Dev

Add button + text in Infragistics ultragrid column

From Dev

Angularjs: How to trigger event when scroll reaches to the bottom of the scroll bar in div?

From Dev

Firing event when scroll bar reaches the bottom of panel

From Dev

How to show FloatingActionButton when the user reaches the bottom?

From Dev

How do you add a Class to an element when the page scroll reaches a specific percentage?

From Dev

JQuery Add Class when bottom of div reaches top

From Dev

Create UserControl By using UltraGrid of Infragistics

From Dev

Scroll HTML page before it 'reaches' the bottom

From Dev

How to stop a UIScrollView from scrolling when it reaches the bottom

From Dev

How to know when scroller of the div reaches the bottom - JQuery

From Dev

How to exit loop when scrollBy reaches the bottom of the web page?

From Dev

jQuery - How to start a script when the scroll reaches the block?

From Dev

jQuery - How to start a script when the scroll reaches the block?

From Dev

How to add some more scroll at the bottom of the page

From Dev

How to add some more scroll at the bottom of the page

From Dev

Add class when element hits top of page AND remove class when element reaches bottom of parent

From Dev

How to place data in a new column when it reaches 10 rows?

From Dev

Infragistics UltraGrid summary value from cell

From Dev

Hide div when user reaches the bottom of page

From Dev

Hide div when user reaches the bottom of page

From Dev

How to add css rule for when div reaches window width

From Dev

Slick Grid how to add seek top & seek bottom scroll buttons?

From Dev

How to pack contents in a div to move to the right when content reaches bottom of the div

From Dev

How to stop the background-position change when the background image reaches bottom?

From Dev

How to pack contents in a div to move to the right when content reaches bottom of the div

From Dev

How to stop the background-position change when the background image reaches bottom?

Related Related

  1. 1

    Infragistics UltraGrid - how to add rows when scroll reaches bottom?

  2. 2

    Infragistics UltraGrid rows displayed from bottom to top

  3. 3

    How to add columns to Infragistics UltraGrid without using designer

  4. 4

    Add button + text in Infragistics ultragrid column

  5. 5

    Angularjs: How to trigger event when scroll reaches to the bottom of the scroll bar in div?

  6. 6

    Firing event when scroll bar reaches the bottom of panel

  7. 7

    How to show FloatingActionButton when the user reaches the bottom?

  8. 8

    How do you add a Class to an element when the page scroll reaches a specific percentage?

  9. 9

    JQuery Add Class when bottom of div reaches top

  10. 10

    Create UserControl By using UltraGrid of Infragistics

  11. 11

    Scroll HTML page before it 'reaches' the bottom

  12. 12

    How to stop a UIScrollView from scrolling when it reaches the bottom

  13. 13

    How to know when scroller of the div reaches the bottom - JQuery

  14. 14

    How to exit loop when scrollBy reaches the bottom of the web page?

  15. 15

    jQuery - How to start a script when the scroll reaches the block?

  16. 16

    jQuery - How to start a script when the scroll reaches the block?

  17. 17

    How to add some more scroll at the bottom of the page

  18. 18

    How to add some more scroll at the bottom of the page

  19. 19

    Add class when element hits top of page AND remove class when element reaches bottom of parent

  20. 20

    How to place data in a new column when it reaches 10 rows?

  21. 21

    Infragistics UltraGrid summary value from cell

  22. 22

    Hide div when user reaches the bottom of page

  23. 23

    Hide div when user reaches the bottom of page

  24. 24

    How to add css rule for when div reaches window width

  25. 25

    Slick Grid how to add seek top & seek bottom scroll buttons?

  26. 26

    How to pack contents in a div to move to the right when content reaches bottom of the div

  27. 27

    How to stop the background-position change when the background image reaches bottom?

  28. 28

    How to pack contents in a div to move to the right when content reaches bottom of the div

  29. 29

    How to stop the background-position change when the background image reaches bottom?

HotTag

Archive