am trying to bind my Checkboxlist programatically based on two input variables ; but i get only one checkbox instead of 3 .
Here are my codes
This is my Business Layer
publicclassBALDisplayPanel2{privatestring _mylabel;publicstringMyLabel{get{return _mylabel;}set{ _mylabel = value;}}privatestring _conditionlabel;publicstringConditionLabel{get{return _conditionlabel;}set{ _conditionlabel = value;}}privatestring _checkboxquestion;publicstringCheckBoxQuestion{get{return _checkboxquestion;}set{ _checkboxquestion = value;}}
This is my Data access Layer
publicList<BALDisplayPanel2>DisplaySPanelQ(int tbid,int grdid){SqlConnection conn =newSqlConnection(ConfigurationManager.ConnectionStrings["mynewdbConnectionString"].ConnectionString);
conn.Open();SqlCommand cmd =newSqlCommand("esp_MyCheckboxProc", conn);
cmd.CommandType=CommandType.StoredProcedure;List<BALDisplayPanel2> lst =newList<BALDisplayPanel2>();
cmd.Parameters.AddWithValue("@Emp", tbid);
cmd.Parameters.AddWithValue("@UnitNumber", grdid);SqlDataReader dr = cmd.ExecuteReader();while(dr.Read()){BALDisplayPanel2 unt =newBALDisplayPanel2();
unt.CheckBoxQuestion= dr["CheckQuest"].ToString();
unt.MyLabel= dr["MyLabel"].ToString();
unt.ConditionLabel= dr["ConditionLabel"].ToString();//unt.LabelS = dr["LabelQ2"].ToString();
lst.Add(unt);}
conn.Close();return lst;}
This is my Default.cs file i call my checkbox
BALDisplayPanel2 bl =newBALDisplayPanel2();DALDisplayPanel2 dal =newDALDisplayPanel2();List<BALDisplayPanel2> lst =newList<BALDisplayPanel2>();
lst = dal.DisplaySPanelQ(Convert.ToInt32(tbEmpID.Text),Convert.ToInt32(GridView1.SelectedRow.Cells[2].Text));foreach(var item in lst){
chbklstpanel3.Items.Clear();
chbklstpanel3.DataSource= lst;
chbklstpanel3.DataTextField= item.CheckBoxQuestion;
lblpanel3.Text= item.MyLabel;
lblCondition.Text= item.ConditionLabel;}
any help appriciate