Event handling: Button Click Vs Repeater OnItemCreated

Discussion in 'ASP .Net' started by Mauritsius, Dec 17, 2004.

  1. Mauritsius

    Mauritsius Guest

    I have a simple page where I would like to modify a repeater (bounded
    to a dataset) if a button (outside the repeater) is clicked or not.

    I tried to solve this with a button click event that raises a global
    flag and a repeater OnItemCreated event that modifies the repeater
    items accordingly.

    My problem is that the click event for the button is fired after the
    OnItemCreated event for the repeater when the flag still has a default
    value. I know a possible solution would be to loop the repeater in the
    click event instead and modify the child controls that needs editing,
    but that seems like a strenuous way to do it compared to OnItemCreated
    event.

    If there was someway to raise the button flag before the OnItemCreated
    event fires it would solve my problem...maybe by moving the flag
    rising code or rerender the repeater someway. Or perhaps there is a
    completely different solution.

    Any help will be much appreciated
    Mauritsius
     
    Mauritsius, Dec 17, 2004
    #1
    1. Advertising

  2. "Mauritsius" <> wrote in message
    news:...
    >I have a simple page where I would like to modify a repeater (bounded
    > to a dataset) if a button (outside the repeater) is clicked or not.
    >
    > I tried to solve this with a button click event that raises a global
    > flag and a repeater OnItemCreated event that modifies the repeater
    > items accordingly.
    >
    > My problem is that the click event for the button is fired after the
    > OnItemCreated event for the repeater when the flag still has a default
    > value. I know a possible solution would be to loop the repeater in the
    > click event instead and modify the child controls that needs editing,
    > but that seems like a strenuous way to do it compared to OnItemCreated
    > event.
    >
    > If there was someway to raise the button flag before the OnItemCreated
    > event fires it would solve my problem...maybe by moving the flag
    > rising code or rerender the repeater someway. Or perhaps there is a
    > completely different solution.


    Call repeater.DataBind again in the button click event.

    John Saunders
     
    John Saunders, Dec 17, 2004
    #2
    1. Advertising

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. Purvi T
    Replies:
    0
    Views:
    934
    Purvi T
    Oct 19, 2004
  2. jorge
    Replies:
    2
    Views:
    1,350
    jorge
    May 26, 2004
  3. Amy
    Replies:
    0
    Views:
    1,038
  4. Max2006
    Replies:
    2
    Views:
    1,639
    Walter Wang [MSFT]
    Sep 19, 2007
  5. jorge
    Replies:
    1
    Views:
    451
    Teemu Keiski
    May 28, 2004
Loading...

Share This Page