sugunsg
December 26th, 2002, 11:15 PM
Hi,
I am generating the CheckBoxList control in Run-Time. I dont know
how to get the selected check box values from dynamically generated checkBoxList.
(I know how to select the values from CheckBoxList if it is desined at runtime)
I tried to use FindControl method but FindControl method returns NULL.
Look the code to generate the CheckBoxList in Run Time.
In Code behind...
CheckBoxList ChkMachines = new CheckBoxList();
ChkMachines.ID = "ChkMachines_" + <some variable>
ChkMachines.DataValueField="MECH_ID";
ChkMachines.DataTextField="MECHNAME";
ChkMachines.RepeatColumns=2;
ChkMachines.DataSource = ReaderMech;
ChkMachines.DataBind();
// MECH_ID, MECHNAME is data base fields
// ReaderMech is OleDBDataReader
// tbale Row and cell are generated dynamically
TableRow tRowMach = new TableRow();
Table2.Rows.Add(tRowMech);
TableCell tCellMech = new TableCell();
tRowMech.Cells.Add(tCellMech);
// then the CheckBoxList Control is added in the table cell
tCellMach.Controls.Add(ChkMachines);
I put the above code in loop.
The CheckBoxLists are generated with out any problem. But I want to know ,How to access the selected checkbox values from the dynamically generated CheckBoxList?
If any one knows Help me to solve this.
Thanks
sugumar
I am generating the CheckBoxList control in Run-Time. I dont know
how to get the selected check box values from dynamically generated checkBoxList.
(I know how to select the values from CheckBoxList if it is desined at runtime)
I tried to use FindControl method but FindControl method returns NULL.
Look the code to generate the CheckBoxList in Run Time.
In Code behind...
CheckBoxList ChkMachines = new CheckBoxList();
ChkMachines.ID = "ChkMachines_" + <some variable>
ChkMachines.DataValueField="MECH_ID";
ChkMachines.DataTextField="MECHNAME";
ChkMachines.RepeatColumns=2;
ChkMachines.DataSource = ReaderMech;
ChkMachines.DataBind();
// MECH_ID, MECHNAME is data base fields
// ReaderMech is OleDBDataReader
// tbale Row and cell are generated dynamically
TableRow tRowMach = new TableRow();
Table2.Rows.Add(tRowMech);
TableCell tCellMech = new TableCell();
tRowMech.Cells.Add(tCellMech);
// then the CheckBoxList Control is added in the table cell
tCellMach.Controls.Add(ChkMachines);
I put the above code in loop.
The CheckBoxLists are generated with out any problem. But I want to know ,How to access the selected checkbox values from the dynamically generated CheckBoxList?
If any one knows Help me to solve this.
Thanks
sugumar