Binding to a datagrid

G

Guest

Hi, I'm using C# VS2003

I need to bind either a Filtered data view or a data set of changed rows, to
a datagrid programmatically to show changed rows before updating. I can't
seem to do it. The Dataset I'm copying the changes from is typed.

The DataTable is DsMaster.Products;

For example:

dsChanges = dsMaster.Clone(); // Is this needed in order to copy the table?
dsChanges = dsMaster.GetChanges();

dgChanges.DataSource = dsChanges;
dgChanges.DataMember = "Products" // Doesn't work.

The other way is:

DataView dv = dsMaster.Products.DefaultView;

dv.RowStateFilter = DataViewRowState.ModifiedCurrent;

dgChanges.DataSource = dv;
dgChanges.dataMember = "Products"; // Again, doesn't work.

I'm sure this is a simple thing to do. What am I doing wrong?

Thanks for any help

Ant
 
S

Shawn Wildermuth (C# MVP)

Hello Ant,

Don't bother binding to the DataSet, but create a new DataView with the filtered
rows you need and bind to that instead...


Thanks,
Shawn Wildermuth
Speaker, Author and C# MVP
http://adoguy.com
 

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