Parent Control!

A

Adam J Knight

Hi all,

Below i have a function which is executed when a check boxes 'CHECKED'
property is changed.
This checkbox is contain within a datagrid item in a datagrid.

What i am after is how to retrieve the datagrid item in which the checkbox
resides.

I have done this in a previous project using visual basic...

eg: dgEmps.DataKeys(CType(sender.Parent.Parent, DataGridItem).ItemIndex)

What i need is the c# equivalent:

Any help appreciated!!!

public void chkEnrolled_Changed(object sender, System.EventArgs e)
{

Response.Write(dgEnrollments.DataKeys[????]);

}
 
G

Guest

Adam,
The "C#" equivalent would be:

dgEmps.DataKeys[((DataGridItem)sender.Parent.Parent).ItemIndex];

As can be seen, the syntax knowledge needed is not particularly difficult.
Good practice to be able to translate between VB.NET and C#.
Peter
 

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,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top