F
Fao, Sean
I've been using the following technique to locate CheckBoxes on a DataList:
private void Button1_Click(object sender, System.EventArgs e)
{
CheckBox checkbox;
foreach (DataGridItem dgitem in this.AuthorsDataGrid.Items)
{
if ((checkbox = (CheckBox) dgitem.FindControl("DataGridCheckBox"))
!= null)
System.Diagnostics.Debug.WriteLine("found it...");
else
System.Diagnostics.Debug.WriteLine(dgitem.ID);
}
}
The only real flaw (that I know of) using this technique is that it
breaks if anybody changes the ID of the CheckBox controls on the DataList.
Is this an acceptable technique? Is there a better way?
Thank you in advance,
private void Button1_Click(object sender, System.EventArgs e)
{
CheckBox checkbox;
foreach (DataGridItem dgitem in this.AuthorsDataGrid.Items)
{
if ((checkbox = (CheckBox) dgitem.FindControl("DataGridCheckBox"))
!= null)
System.Diagnostics.Debug.WriteLine("found it...");
else
System.Diagnostics.Debug.WriteLine(dgitem.ID);
}
}
The only real flaw (that I know of) using this technique is that it
breaks if anybody changes the ID of the CheckBox controls on the DataList.
Is this an acceptable technique? Is there a better way?
Thank you in advance,