D
DotNetJunkies User
Hi,
I have a checkbox control programmatically created for each row in the datagrid but CheckedChanged event not firing when state of the checkbox changes.
I use the following code to instantiate ItemTemplate with checkbox contructor:
public class TemplateObject : ITemplate {
public void InstantiateIn(Control objContainer) {
CheckBox objCheckBox = new CheckBox();
objCheckBox.ID = "Item";
objCheckBox.CheckedChanged +=new EventHandler(objCheckBox_CheckedChanged);
objContainer.Controls.Add(objCheckBox);
}
public void objCheckBox_CheckedChanged(object sender, EventArgs e) {
CheckBox objCheckBox = (CheckBox)sender;
if(objCheckBox.Checked) {
//Do Something
}
}
}
Any advice much appreciated.
Andrew
I have a checkbox control programmatically created for each row in the datagrid but CheckedChanged event not firing when state of the checkbox changes.
I use the following code to instantiate ItemTemplate with checkbox contructor:
public class TemplateObject : ITemplate {
public void InstantiateIn(Control objContainer) {
CheckBox objCheckBox = new CheckBox();
objCheckBox.ID = "Item";
objCheckBox.CheckedChanged +=new EventHandler(objCheckBox_CheckedChanged);
objContainer.Controls.Add(objCheckBox);
}
public void objCheckBox_CheckedChanged(object sender, EventArgs e) {
CheckBox objCheckBox = (CheckBox)sender;
if(objCheckBox.Checked) {
//Do Something
}
}
}
Any advice much appreciated.
Andrew