Advertisement
| 03.20.2008 at 01:17PM PDT, ID: 23258300 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: |
Building of checkboxes:
int cnt = 0;
foreach (DataRowView dr in dv)
{
if ((cnt % 3) == 0)
{
row = new TableRow();
cell = new TableCell();
cell.ID = "Cell" + cnt.ToString();
cell.CssClass = "style2";
CheckBox chk = new CheckBox();
chk.ID = "chk" + dr["Name"].ToString().Replace(" ", "");
chk.Text = dr["Name"].ToString();
cell.Controls.Add(chk);
row.Cells.Add(cell);
}
else
{
cell = new TableCell();
cell.ID = "Cell" + cnt.ToString();
CheckBox chk = new CheckBox();
chk.ID = "chk" + dr["Name"].ToString().Replace(" ", "");
chk.Text = dr["Name"].ToString();
cell.Controls.Add(chk);
row.Cells.Add(cell);
}
if ((cnt % 3) == 0)
tblCategories.Rows.Add(row);
cnt++;
}
Trying to find checkboxes: // this is the Problem
foreach (TableRow row in tblParentCategories.Rows)
{
Control ctl = new Control();
ctl = (Control)row.FindControl();
if (ctl.GetType() == typeof(CheckBox))
if (chk.Checked == true)
{
chk.Text = (ctl as CheckBox).Text;
CategoryName = chk.Text;
}
}
|
Advertisement