This is how you can create Checkbox dynamically in run time in C#.Net.
C# Code:
for (int i = 0; i < 10; i++)
{
CheckBox chkList1;
chkList1 = new CheckBox();
chkList1.Text = "CheckBox " + i.ToString();
chkList1.ID = "Chk" + i.ToString();
chkList1.Font.Name = "Verdana";
chkList1.Font.Size = 9;
PnlControl.Controls.Add(chkList1);
PnlControl.Controls.Add(new LiteralControl("</br>
"));
}
Accordingly you can modify this code.
aspx Code:
<asp:Panel ID="PnlControl" runat="server"> </asp:Panel>
C# Code:
for (int i = 0; i < 10; i++)
{
CheckBox chkList1;
chkList1 = new CheckBox();
chkList1.Text = "CheckBox " + i.ToString();
chkList1.ID = "Chk" + i.ToString();
chkList1.Font.Name = "Verdana";
chkList1.Font.Size = 9;
PnlControl.Controls.Add(chkList1);
PnlControl.Controls.Add(new LiteralControl("</br>
"));
}
Accordingly you can modify this code.