Home All Groups Group Topic Archive Search About
Author
24 May 2005 5:42 PM
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.

Author
25 May 2005 5:58 PM
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen



Show quoteHide quote
> 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.
>