ItemDataBound event does not fire for selected row.

G

Guest

I'm using the ItemDataBound event of the DataGrid to highlight cells that are
outside an acceptable range. Each row has a button column
(CommandName='Select'), that is used to display addtional details below the
grid.

When the page first loads and when the 1st button column is clicked, the
ItemDataBound event fires for each row in the datasource. But when the 2nd
button column is clicked, the ItemDataBound event does not fire for the row
that was clicked the first time. I know this may sound confusing so I've
include my debug output below. There should always be 8 rows bound,
4/10/2006 - 4/18/2006. All the rows are bound and appear in the grid as they
should, it's just the ItemDataBound event doesn't fire. Anyone seen this one
before?
Thanks,
Mark

// initial page_load
ItemIndex: 18
DateHour: 04/10/2006
ItemIndex: 19
DateHour: 04/11/2006
ItemIndex: 20
DateHour: 04/12/2006
ItemIndex: 21
DateHour: 04/13/2006
ItemIndex: 22
DateHour: 04/14/2006
ItemIndex: 23
DateHour: 04/15/2006
ItemIndex: 24
DateHour: 04/16/2006
ItemIndex: 25
DateHour: 04/17/2006
ItemIndex: 26
DateHour: 04/18/2006

// click on row for 4/11/2006
ItemIndex: 18
DateHour: 04/10/2006
ItemIndex: 19
DateHour: 04/11/2006
ItemIndex: 20
DateHour: 04/12/2006
ItemIndex: 21
DateHour: 04/13/2006
ItemIndex: 22
DateHour: 04/14/2006
ItemIndex: 23
DateHour: 04/15/2006
ItemIndex: 24
DateHour: 04/16/2006
ItemIndex: 25
DateHour: 04/17/2006
ItemIndex: 26
DateHour: 04/18/2006

// click on row for 4/13/2006: now row 4/11/2006 with ItemIndex 19 is missing.
ItemIndex: 18
DateHour: 04/10/2006
ItemIndex: 20
DateHour: 04/12/2006
ItemIndex: 21
DateHour: 04/13/2006
ItemIndex: 22
DateHour: 04/14/2006
ItemIndex: 23
DateHour: 04/15/2006
ItemIndex: 24
DateHour: 04/16/2006
ItemIndex: 25
DateHour: 04/17/2006
ItemIndex: 26
DateHour: 04/18/2006
 
G

Guest

I figured it out. The event is firing, but after selection, the ItemType is
no longer ItemType.Item or ItemType.AlternatingItem, it is now
ItemType.SelectedItem. I added the check for ItemType.SelectedItem and am
now processing the event correctly.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top