Hello,
I have a Datalist and I am trying to insert a checkbox for each record that gets bound to the datalist. The first record has the checkbox but the subsequent records do not. I suspect that what I am doing is just replacing the first checkbox eachtime a record is bound. Can someone give me some insight? I need the checkbox to be repeated for each record.
alertList.ItemTemplate = new AlertItemTemplate(groupTracker);
if (!Page.IsPostBack) {
alertList.DataBind();
}
Here is my overridden bind method:
public override void DataBind()
{
//Auto Chart
TableCell autoChartCell;
autoChartCell = new TableCell();
autoChartCell.BorderStyle = BorderStyle.Solid;
autoChartCell.VerticalAlign = VerticalAlign.Top;
autoChartCell.Controls.Add(autoChartChkBox = new CheckBox());
autoChartCell.Controls.Add(autoChartLbl = new Label());
Rows[1].Cells.Add(autoChartCell);
autoChartLbl.Text = "AutoChart";
autoChartChkBox.Checked = item.IncludeInChartNotes;
alertTypeNameCell.ColumnSpan = Rows[1].Cells.Count;
}
}