Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private static List<datatable> SplitTable(DataTable originalTable, int batchSize)
{
List<datatable> tables = new List<datatable>();
int i = 0;
int j = 1;
DataTable newDt = originalTable.Clone();
newDt.TableName = "Table_" + j;
newDt.Clear();
foreach (DataRow row in originalTable.Rows)
{
DataRow newRow = newDt.NewRow();
newRow.ItemArray = row.ItemArray;
newDt.Rows.Add(newRow);
i++;
if (i == batchSize)
{
tables.Add(newDt);
j++;
newDt = originalTable.Clone();
newDt.TableName = "Table_" + j;
newDt.Clear();
i = 0;
}
}


C#
{
           //MouseButton mb = (MouseButton)e.OriginalSource;
           //ScrollViewer sv = (ScrollViewer)e.OriginalSource;

           if ((SampleDatagrid.ScrollInfo.VerticalOffset) > 400) //commencted
               //Double d=e.(SampleDatagrid);
               if (((SampleDatagrid.Records.Count / 4) * 3) < SampleDatagrid.ScrollInfo.VerticalOffset) //commencted
               {
                   SampleDatagrid.DataSource = SystemDataHelpers.RowList(dt, 0, 300+Convert.ToInt32(SampleDatagrid.ScrollInfo.VerticalOffset));
                   Scrollcount = Scrollcount + 1;
                   scrollsize = scrollsize + 500;
                  fillDatagrid(ldtdt);
                   //SampleDatagrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
                   //SplitTable(dt, size);
               }
       }




i am using Infragistics controls
C#
{
          
           if ((SampleDatagrid.ScrollInfo.VerticalOffset) > 400) //commencted
               //Double d=e.(SampleDatagrid);
               if (((SampleDatagrid.Records.Count / 4) * 3) < SampleDatagrid.ScrollInfo.VerticalOffset) //commencted
               {
                   SampleDatagrid.DataSource = SystemDataHelpers.RowList(dt, 0, 300+Convert.ToInt32(SampleDatagrid.ScrollInfo.VerticalOffset));
                   Scrollcount = Scrollcount + 1;
                   scrollsize = scrollsize + 500;
                  fillDatagrid(ldtdt);
                  
               }
       }

SampleDatagrid.DataSource = dt.DefaultView;

I got Solution but my Scroll is going top when i load data

but i want to My scroll should stay there only
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900