CheckedChanged does not fire in Repeater

P

Piotr Strycharz

Hi,

I have a Repeater with CheckBox in one of its columns. In ItemDataBound
handler I'm doing:
chk.CheckedChanged += new EventHandler(chk_CheckedChanged).
The chk_CheckedChanged handler is supposed to fire when I click the
checkbox. Hoewever - it does not! It does not depend on EnableSessionState,
it does not depend on AutoPostBack. simply - does not fire at all.
Now - how am I going to know if user selects one of the rows in the
repeater? Sample code please...

Use button instead? Button webcontrol seems to fire events - this would be
however unpleasant solution to customer...

Piotr.
 
K

Karl

You need to handle the ItemCommand of the repeater....the CheckedChanged
event bubbles up to the repeater..

Karl
 
P

Piotr Strycharz

User "Karl said:
You need to handle the ItemCommand of the repeater....the CheckedChanged
event bubbles up to the repeater..

I don't know if you have ever checked this solution, but also ItemCommand
does NOT fire for me...
I have put code:
RP1.ItemCommand += new RepeaterCommandEventHandler(RP1_ItemCommand);
just before RP1.DataBind() in Page_Load(). Is this right place?

Regards,

Piotr.
 
K

Karl

Piotr,
I'm misinforming you. Do what you were doing previously but put the code in
the ItemCreated event of the repeater (instead of ItemDataBound). The
problem is that when you postback, ItemDataBound isn't fired (the repeater
isn't databound, it's rebuilt from the viewstate) and as such your
checkbox's event isn't wired. ItemCreated is called in either instances.

Karl
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top