underlying value of datagrid selection

quwiltw

Contributor
Joined
Sep 18, 2001
Messages
486
Location
Washington, D.C.
I've had all of my columns showing while building my little app and have been accessing the selected primary key (ID) via it's row/column index because it has been shown. Now I have applied a TableStyle to it that hides the ID (which the user shouldn't care about anyway).

What's a reliable way of finding out a column in the underlying (bound) dataset that is not currently being displayed in the datagrid?

ie. Dataset has columns (id, title, message, url)

but
Datagrid only has (title, message, url)
 
I thought I read somewhere that one couldn't depend on the currentrow index of the datagrid to be the same as the underlying datatable, but it works and I can't find that now. Thanks,
 
Yes, the DG and the DS may not be identical, but since the ID is hidden in the DG and cannot be altered by the user, then they should be (in this case) in sync.

Also, there is a DS property HasChanges which you can use to see if in deed there were changes. Then use AcceptChanges to reset the HasChnages once you update the DB.
 
Back
Top