S
Steven
I create the checkboxes dynamically on my webform (aspx). after I create
them, when I check any of the checkboxes, nothing happens. Here is my code
...
ArrayList LayerNameList1 = LayerNameList;
CheckBox[] checkBoxArray;
int BoxCount = 0;
HtmlTableRow newRow;
HtmlTableCell FieldCell;
System.Web.UI.HtmlControls.HtmlTable ContainerTable = new HtmlTable();
checkBoxArray = new CheckBox[250];
foreach(string item in LayerNameList1)
{
newRow = new HtmlTableRow();
FieldCell = new HtmlTableCell();
FieldCell.Style.Add("font-family", "Arial");
FieldCell.Style.Add("font-size", "smaller");
checkBoxArray[BoxCount] = new CheckBox();
checkBoxArray[BoxCount].ID = Convert.ToString(BoxCount);
checkBoxArray[BoxCount].Text = item;
checkBoxArray[BoxCount].CheckedChanged += new
System.EventHandler(checkBox_CheckedChanged);
FieldCell.Controls.Add(checkBoxArray[BoxCount]);
newRow.Controls.Add(FieldCell);
ContainerTable.Controls.Add(newRow);
BoxCount++;
}
this.placeHolder.Controls.Add(ContainerTable);
}
public void checkBox_CheckedChanged(object sender, System.EventArgs e)
{
CheckBox cb = (CheckBox) sender;
if (cb.Checked)
{ testdel.Text = "1"; }
else
{ testdel.Text = "2";
}
}
Any suggestions?
Regards
Praveen
them, when I check any of the checkboxes, nothing happens. Here is my code
...
ArrayList LayerNameList1 = LayerNameList;
CheckBox[] checkBoxArray;
int BoxCount = 0;
HtmlTableRow newRow;
HtmlTableCell FieldCell;
System.Web.UI.HtmlControls.HtmlTable ContainerTable = new HtmlTable();
checkBoxArray = new CheckBox[250];
foreach(string item in LayerNameList1)
{
newRow = new HtmlTableRow();
FieldCell = new HtmlTableCell();
FieldCell.Style.Add("font-family", "Arial");
FieldCell.Style.Add("font-size", "smaller");
checkBoxArray[BoxCount] = new CheckBox();
checkBoxArray[BoxCount].ID = Convert.ToString(BoxCount);
checkBoxArray[BoxCount].Text = item;
checkBoxArray[BoxCount].CheckedChanged += new
System.EventHandler(checkBox_CheckedChanged);
FieldCell.Controls.Add(checkBoxArray[BoxCount]);
newRow.Controls.Add(FieldCell);
ContainerTable.Controls.Add(newRow);
BoxCount++;
}
this.placeHolder.Controls.Add(ContainerTable);
}
public void checkBox_CheckedChanged(object sender, System.EventArgs e)
{
CheckBox cb = (CheckBox) sender;
if (cb.Checked)
{ testdel.Text = "1"; }
else
{ testdel.Text = "2";
}
}
Any suggestions?
Regards
Praveen