Any one can help... I need to access dynamically added checkboxes in other events I will share my code
void bindMaterials()
{
try
{
SqlConnection Con = new SqlConnection(conString);
SqlCommand FCimsbindoptCommand = Con.CreateCommand();
FCimsbindoptCommand.Connection = Con;
FCimsbindoptCommand.CommandText = "select * from nhcms_privilege";
SqlDataAdapter FCimsSrchAdapter = new SqlDataAdapter(FCimsbindoptCommand);
DataTable FCimsSrchDataSet = new DataTable();
FCimsSrchAdapter.Fill(FCimsSrchDataSet);
int rowcount = FCimsSrchDataSet.Rows.Count;
var a = new List<string>();
foreach (DataRow row in FCimsSrchDataSet.Rows)
{
a.Add(row["Privilege_Name"].ToString());
}
string[] strdata = a.ToArray();
foreach (var value in a)
{
CheckBox checkbox = new CheckBox();
checkbox.ID = "chk" + value;
checkbox.Text = value;
Panel1.Controls.Add(checkbox);
}
}
catch (Exception e)
{
}
}
I want to access these check box controls into button event