Availability of e.Item.DataItem in DataGrid?

D

Dave

I'm trying to understand when DataItem will be available to use as follows:

DataRowView rowData = (DataRowView)(e.Item.DataItem);
int someId = (int)(rowData["someId"]);

I found that e.Item.DataItem is available in DataGrid ItemDataBound such as

private void dgMyDataGrid_ItemDataBound(Object sender, DataGridItemEventArgs
e)

But not in Update method as in

private void dgCompanyCodes_Update(Object sender, DataGridCommandEventArgs e)

I guess I don't know why? Otherwise I have to use the following.

string myId= e.Item.Cells[0].Text;
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top