Event handlers called multiple times

Discussion in 'ASP .Net Datagrid Control' started by Tumurbaatar S., Nov 11, 2005.

  1. My DataGrid's event handlers looks like:
    Grid_ItemDataBound(...)
    {
    switch (e.Item.ItemType):
    {
    case ListItemType.Footer:
    ...// BREAKPONT FooterBound
    break;
    case ...// other item types
    }
    }

    and

    Grid_ItemCreated(...)
    {
    if (e.Item.ItemType == ListItemType.Pager)
    {
    ...// BREAKPONT PagerCreated
    }
    }

    During debug session I put 2 breakpoints as shown above. And I noted strange
    things:
    1. On the first time, events are called in this order: PagerCreated,
    FooterBound, PagerCreated.
    I.e. Pager item created event raised 2 times!
    2. After postback they are called: PagerCreated, PagerCreated, PagerCreated,
    FooterBound, PagerCreated
    Now Pager item created event raised 4 times!!!

    What is happening?

    P.S. Can anybody recommend me any reference about event calling in ASP.NET
    which explains all above things?
     
    Tumurbaatar S., Nov 11, 2005
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.