Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Access Programmatically Added checkbox
    primarykey
    data
    text
    <p>I am developing an application in which i needed the to add filter. for that am adding checkbox programmatically because the filtering option are not predefine it depends on the value in the table to i add the checkbox as fallow </p> <pre><code>public void addCusineCheckbox() { DataTable CusineList = Sql.ExecuteSelectCommand("select prod_group_id,Prod_group_name from Master_Prod_Groups"); for (int i = 0; i &lt; CusineList.Rows.Count; i++) { CheckBox chkCusine = new CheckBox(); chkCusine.ID = "chk" + CusineList.Rows[i]["Prod_group_name"].ToString(); chkCusine.Text = CusineList.Rows[i]["Prod_group_name"].ToString(); divCusineFilter.Controls.Add(chkCusine); } } </code></pre> <p>which help user to select the required field(there more other option to select) and then click on apply filter on that am try to access the that added check box as fallow</p> <pre><code>public string getCusineFilterString() { string CusineID =null; DataTable CusineList = Sql.ExecuteSelectCommand("select prod_group_id,Prod_group_name from Master_Prod_Groups"); for (int i = 0; i &lt; CusineList.Rows.Count; i++) { CheckBox chk = (CheckBox)Page.FindControl("chk" + CusineList.Rows[i]["Prod_group_name"]); if (chk.Checked == true) { if (i == 0) { CusineID = CusineList.Rows[i]["prod_group_id"].ToString(); } else { CusineID = CusineID + "," + CusineList.Rows[i]["prod_group_id"].ToString(); } } } return CusineID; } </code></pre> <p>but it gives the error that object not set to an instance.</p> <p>i am not getting any idea to access to the checkbox.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload