Get value from cell in a DataGrid

J

James

I would like to get a value in a cell for the currently
selected item in a DataGrid. The catch is I do not want
to use an index number to access the cell. I want to use
the DataField property of the column for the cell I want
to access for the current row.

I don't want:
objDataGrid.SelectedItem.Cells(5).Text

I do want something like:
objDataGrid.SelectedItem.Cells("CustomerID).Text

or something like you can do with a DataTable:
objDataTable.Rows(0).Item("CustomerID").Value

The main thing is that I want to be able to get the value
out of a cell in a DataGrid using a string and not an
Index.

Thanks
 
O

One Handed Man

One alternative is to assign ordinal values to text is a value pair list,
this way you can look up the reference ( index ) number.

OHM
 

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