OnItemDatabound requires Item or AlternatingItem and Item?

K

kidpurple

This took me a while to figure out:

I have 2 datagrids on the same webform, they are very similar, but of
course have different names, datasources, and OnItemDataBound
handlers. I am attaching a javascript confirm onto a delete button in
each datagrid. the first one worked fine, but the second one only
attached the confirm on every other item.

So I finally fixed that and my OnItemDataBound handlers look like this
now:

dg1:
if (e.Item.ItemType == ListItemType.Item) .....

dg2:
if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType ==
ListItemType.AlternatingItem) .....

So how does one work with just looking for ListItemType.Item, while
the other needed both Item and AlternatingItem? Makes me curious.....

Thanks,
kp
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top