OnItemDatabound requires Item or AlternatingItem and Item?

Discussion in 'ASP .Net Datagrid Control' started by kidpurple, Nov 2, 2004.

  1. kidpurple

    kidpurple Guest

    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
     
    kidpurple, Nov 2, 2004
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Antonio D'Ottavio
    Replies:
    1
    Views:
    2,933
    Antonio D'Ottavio
    Sep 19, 2005
  2. Steven
    Replies:
    1
    Views:
    1,826
    Simon
    Jul 9, 2003
  3. MattB

    datalist and OnItemDatabound

    MattB, Mar 28, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,194
    MattB
    Mar 29, 2005
  4. Beffmans

    AlternatingItem Style in asp:table

    Beffmans, Jul 20, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    548
    =?Utf-8?B?U2l2YSBN?=
    Jul 20, 2005
  5. DebonairDC

    AlternatingItem without repeating code

    DebonairDC, Nov 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    439
    DebonairDC
    Nov 11, 2005
  6. ibiza
    Replies:
    2
    Views:
    6,036
    ibiza
    Feb 1, 2006
  7. K Viltersten
    Replies:
    6
    Views:
    580
    Nathan Sokalski
    Oct 5, 2009
  8. Pete Coolidge

    OnItemCreated and OnItemDataBound called too many times?

    Pete Coolidge, Jul 4, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    377
    Pete Coolidge
    Jul 4, 2003
Loading...