wpf - Wrong index after re-ordering datagrid rows -


i have data table bound data grid, , when re-order rows, index of string i'm looking gets messed up.

i index of serial num column... works, after i've moved it.

dim snindex integer = asset_masterdatagrid.columns.[single](function(c) c.header.tostring() = "serial num").displayindex  

then direct cast row i'm clicking

dim item datarowview = directcast(asset_masterdatagrid.selecteditem, datarowview) 

then grab string of cell in serial num column.

 dim sn string = item.row(snindex) 

enter image description here of course doesn't work, , when re-order serial number column lets say... index 0, grabs asset id cell string. i'm trying find serial number of whatever row click on, no matter serial number column is.

any ideas on how correct issue?

you can access column of datarowview name rather index:

dim item datarowview = directcast(asset_masterdatagrid.selecteditem, datarowview) dim sn string = item("serial num") 

this should work provided know name of serial number column.


Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -