This is a migrated thread and some comments may be shown as answers.

Advanced data binding with large amount of data

1 Answer 214 Views
Grid
This is a migrated thread and some comments may be shown as answers.
miksh
Top achievements
Rank 1
Iron
miksh asked on 15 Apr 2014, 12:44 PM
Advanced data binding with NeedDataSource event works perfectly for me when I need paging, sorting, grouping and filtering.
Below is the code snippet from your documentation:

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    String ConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConnString);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand("SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address FROM Customers", conn);
 
    DataTable myDataTable = new DataTable();
 
    conn.Open();
    try
    {
        adapter.Fill(myDataTable);
    }
    finally
    {
        conn.Close();
    }
 
    RadGrid1.DataSource = myDataTable;
}

The problem with that approach is that it needs to return all the data from database to let the grid make further data processing. What would you recommend to change in  the code snippet above if there is a million customer records in database and you need to implement paging, sorting and filtering and grouping on each field?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Apr 2014, 04:53 AM
Hi Miksh,

You can try to implement the approaches mentioned below when having large amount of data:
Custom Paging - Online demo on CustomPaging
Virtualization - Online demo on Virtualization

Thanks,
Princy
Tags
Grid
Asked by
miksh
Top achievements
Rank 1
Iron
Answers by
Princy
Top achievements
Rank 2
Share this question
or