protected void CheckBoxList3_SelectedIndexChanged(object sender, EventArgs e) { // Loop through each item. foreach (ListItem item in CheckBoxList3.Items) { if (item.Selected) { // If the item is selected, add the value to the list. YrStrList2.Add(item.Value); } else { // Item is not selected, do something else. } } ListBox10.DataSource = YrStrList2; ListBox10.DataBind(); }
private void Filldivisiondrp() { string strSql = "select OCE_ID,replace(convert(char(40),ltrim(OCE_DESCRIPTION ))+OCE_ID,' ',' ' ) as DIVISIONNAME from ENT_ORG_COMMON_ENTITIES where OCE_ISDELETED='0' AND CEM_ENTITY_ID='DIV'"; SqlCommand cmd = new SqlCommand(strSql, conString); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet thisDataSet = new DataSet(); adpt.Fill(thisDataSet); ListBox4.DataValueField = "oce_id"; ListBox4.DataTextField = "DIVISIONNAME"; ListBox4.DataSource = thisDataSet.Tables[0]; ListBox4.DataBind(); ListBox10.DataValueField = "oce_id"; ListBox10.DataTextField = "DIVISIONNAME"; ListBox10.DataSource = thisDataSet.Tables[0]; ListBox10.DataBind(); }
private void fillEntities() { string mgrId = Session["uid"].ToString(); string levelId = Session["levelId"].ToString(); //SqlConnection con = new SqlCOConnection(m_connectons); if (conString.State == ConnectionState.Closed) { conString.Open(); } SqlCommand cmd = new SqlCommand("spFillEntities2", conString); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@levelid", levelId); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet thisDataSet = new DataSet(); adpt.Fill(thisDataSet); if (conString.State == ConnectionState.Open) { conString.Close(); } ListBox1.DataValueField = "EOD_EMPID"; ListBox1.DataTextField = "EmployeeName"; ListBox1.DataSource = thisDataSet.Tables[0]; ListBox1.DataBind(); ListBox7.DataValueField = "EOD_EMPID"; ListBox7.DataTextField = "EmployeeName"; ListBox7.DataSource = thisDataSet.Tables[0]; ListBox7.DataBind(); DataTable dtDivision = thisDataSet.Tables[3].DefaultView.ToTable(true, "DivisionID", "Division_NAME"); ListBox4.DataValueField = "DivisionID"; ListBox4.DataTextField = "Division_NAME"; ListBox4.DataSource = dtDivision; ListBox4.DataBind(); ListBox10.DataValueField = "DivisionID"; ListBox10.DataTextField = "Division_NAME"; ListBox10.DataSource = thisDataSet.Tables[3]; ListBox10.DataBind(); DataTable dtLocation = thisDataSet.Tables[1].DefaultView.ToTable(true, "LocationID", "Location_NAME"); ListBox3.DataValueField = "LocationID"; ListBox3.DataTextField = "Location_NAME"; ListBox3.DataSource = dtLocation; ListBox3.DataBind(); ListBox9.DataValueField = "LocationID"; ListBox9.DataTextField = "Location_NAME"; ListBox9.DataSource = thisDataSet.Tables[1]; ListBox9.DataBind(); }