If your column is a BoundColumn, and if it is not autogenerated, you can get
the field name as
(myGrid.Columns[0] as BoundColumn).DataField
If it is autogenerated, you can get the field names in ItemCreated event for
the grid column headers. The cell text will be set to the column header,
which should be the same as data field name.
Eliyahu
"Dinçer" <dincer"AT"o2.pl> wrote in message
news:OJ**************@TK2MSFTNGP11.phx.gbl...
"dataGridItem.Cells[0].Text" gives me the value of the cell; for example :
Bill
"dataGridItem.Cells[1].Text" gives me the value of the second cell; for
example : Gates
These are OK.
What I need is the field name of these values in the database; for
example: "name" and "surname" for the data above
Is there anyway to get these values?
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:u9**************@TK2MSFTNGP15.phx.gbl... What do you mean by datafield value?
Eliyahu
"Dinçer" <dincer"AT"o2.pl> wrote in message
news:OM****************@tk2msftngp13.phx.gbl... Hi all!
I want to get the datafield value of a cell in a datagrid item. How
can I do this?
I have a for loop (as below) and I am able to get the data in the
cell, but not the datafield value.
Regards.
foreach(DataGridItem dataGridItem in MyDataGrid)
{
string cellText = dataGridItem.Cells[0].Text;
//string cellValue = ???
}