Hello Louise,
Use the reference to checkbox control to loop through the containing
controls collection of the DataGridItem to find the location of the checkbox.
In implementing nested controls within databound template controls you can
make the implementation easier by using event delegates and customized event
handlers to pass the exact information that you need. The client that would
use your control would get all the information that you want to communicate
to them through the event arguments. I have an example that demonstrates to
you how to create the event delegates and the event handlers on this link:
http://www.societopia.net/Samples/Da...Delegates.aspx
HTH,
Phillip Williams
http://www.societopia.net http://www.webswapp.com
"louise raisbeck" wrote:
Hi,
I have a dynamically built datagrid. I have a checkbox and a label in each
cell. When the checkbox is ticked something should happen, using the label in
the same cell as the checkbox. But I do not know which column it will be
ticked in. Obviously I can get the checkbox using sender, and I can get the
datagrid item using what I've done below. but my third line is where I am
stuck. Can anyone help?
CheckBox cb = (CheckBox)sender;
DataGridItem dgItem = (DataGridItem)(cb.NamingContainer);
intSomeID = ((Label)dgItem.cell i am within.Controls[1]).Text