views:

46

answers:

3

I am using a DataGrid (.NET 1.1) to which data is being binded from data source which gets almost 3000 rows and 25 columns. Because of heavy data, it is taking around 3 minutes to laod data on to datagrid. I want to load first50 records, then next 50 , then next 50... so on...

How can I achieve this ?.. i tried using Paging option but it loads whole records..

Any ideas ??

A: 

Is this the kind of functionality you are looking for?

    Me.DataGrid1.DataSource = DataRange(5, 25, DataSet1.Tables(0))

.

  Private Function DataRange(ByVal Min As Integer, ByVal Max As Integer, ByRef SourceTable As DataTable) As DataTable
    Dim TempTable As DataTable = SourceTable.Clone
    If Max > SourceTable.Rows.Count Then
      Max = SourceTable.Rows.Count
    End If
    For i As Integer = (Min - 1) To (Max - 1)
      TempTable.ImportRow(SourceTable.Rows(i))
    Next
    Return TempTable
  End Function

As decompiled said, make sure the slowness isn't in your query.

bluecoder
Not really..... I am looking for something which will dynamically load 50rows first then next 50 rows... Is there any way we can implement Custom Paging ?..
msbyuva
Are you trying to load 50 rows at a time from database to dataset or 50 rows at a time from dataset to form? Is this for Winforms or ASP.NET? In your comment above, you mention filling your columns from 4 separate queries. Can you give a sample of this code? Why aren't you joining all of the data in the database?
bluecoder
I am querying from different databases and the conditions for those values are different from each other... I am using ASP.NET.. I want to load from database to dataset..
msbyuva
Does Any 1 has the sample code for Custom Paging ?..
msbyuva
A: 

What you are looking for is called Data Paging <-- this link provides an in-depth tutorial on data paging in asp.net.

dboarman
customized data paging... i want to load data{ rows} in intervals
msbyuva
A: 

You can check this solution - http://aspnet.4guysfromrolla.com/articles/031506-1.aspx

Ivan Stefanov