underlying value of datagrid selection

quwiltw

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

Whats 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 couldnt depend on the currentrow index of the datagrid to be the same as the underlying datatable, but it works and I cant 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