Event handling: Button Click Vs Repeater OnItemCreated

M

Mauritsius

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
 
J

John Saunders

Mauritsius said:
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
 

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,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top