Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii in my application based on drop down item selection check box list fill some items.after fill the items all the items will be checked .


please share any idea to me.

i am using this code
C#
companyname = Droppeersnlcompanylist.SelectedItem.ToString();
            string state = droppeersstate.SelectedItem.Text; ;
            string lob = droppeerslob.SelectedItem.Text;
            string top = Droppeerstop.SelectedItem.Text;
            dalclasss objDAL = new dalclasss();
            DataTable dt = new DataTable();
            dt = objDAL.Getdata(companyname, state, lob, top);

            checkboxsnlcompanylist.Items.Clear();
            //Session["peers"] = dataTable;
            checkboxsnlcompanylist.DataSource = dt_peers;
            checkboxsnlcompanylist.DataTextField = dt_peers.Columns[0].ToString();
            checkboxsnlcompanylist.DataValueField = dt_peers.Columns[0].ToString();
            
            checkboxsnlcompanylist.DataBind();
            for (int i = 0; i < checkboxsnlcompanylist.Items.Count; i++)
            {
                checkboxsnlcompanylist.SelectedItem.Selected = true;
            }

please share any idea to me
Posted
Updated 22-Jan-14 23:17pm
v2

1 solution

C#
for (int i = 0; i < checkboxsnlcompanylist.Items.Count; i++)
            {
                checkboxsnlcompanylist.Items[i].Selected = true;
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900