question with Datagrid.datasource ...

V

VM

If I'm filling a DataTable and, in the middle of the table fill, I set the
datagrid.datasource to this table, how can I stop the grid from reflecting
the changes from the table after I set the dartasource? Since I' m not sure
I'm explainng it well, here's some pseudocode:

for (int i =0;i<20000;i++)
{
rowAudit = mytable.NewRow();
// Code fills rowAudit
mytable.Rows.Add(rowAudit);
if (i == 500)
{
mygrid.DataSource = mytable;
//there are still 19500 rows to go but I don't want to see them in
the grid even though they'll be added to the table.
}
}
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

If you are using a asp.net datagrid you can do so by calling
DataGrid.DataBind() the grid will get only the rows that exist at that
moment in the table

I don;t know if that will work with a win. app based grid.


Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top