|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
e.item.dataitemhey,
I have created a datalist and added some data into it, via a dataset. Each row contains an +/- button, which has a commandname associated to it. Now whenever somebody presses the +/- button, I need to get the data from that cell. For that I am using the ItemCommand, but e.item.dataitem is always empty. How I am supposed to get the data? Any help is very appreciated. Thanks AFAIK there will not be anything in dataItem when an event is posted.
It is used inside the xxx_ItemDataBound events while the display is being built. The event artgs has an ItemIndex property that indicated which row was clicked. You can use this to read the proper key and get the unique identifier : int rowNum = e.Item.ItemIndex; string pKey = dgrid.DataKeys[ rowNum ].ToString(); - Andrew Backer
Hyperlink Format
DataGrid Export to Excel Can't get a reference to user control in datagrid How can I format a telephone # in the datagrid Sorting Datagrid With Hyphen / Dash email validation DataGrid sort when Editing How to read Column0 from DataGrid Modify rows in DataTable Changing text to a textbox control in row 5 of a datagrid |
|||||||||||||||||||||||