Checkbox within a datalist

U

UJ

I have a datalist with a checkbox in it to tell whether something is
selected or not. Once somebody changes the checked value and I call the
OnCheckedChanged routine, there doesn't seem to be enough information to
figure out which row the record belongs to. I've look at the sender object
in the debugger and it doesn't have enough to make it useful.

What are people doing to make this work?

TIA.

Jeffrey.
 
B

Brock Allen

Yeah, unfortunately the CheckBox doesn't bubble the event up to the DataGrid.
You could use the sender parameter and walk up the Control.Parent tree until
you find the DataGridItem which is the row in the table. Once you have the
DataGridItem, you'll know the ItemIndex and then you can use that to index
into the DataGrid's DataKey collection to get the primary key for the item.
It's a hack, but it works.
 

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

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top