public void loaditem() { try { cbl_itemname.Items.Clear(); string itemheader = ""; string subheader = ""; for (int i = 0; i < cbl_headername.Items.Count; i++) { if (cbl_headername.Items[i].Selected == true) { if (itemheader == "") { itemheader = "" + cbl_headername.Items[i].Value.ToString() + ""; } else { itemheader = itemheader + "'" + "," + "" + "'" + cbl_headername.Items[i].Value.ToString() + ""; } } } for (int i = 0; i < cbl_subheadername.Items.Count; i++) { if (cbl_subheadername.Items[i].Selected == true) { if (subheader == "") { subheader = "" + cbl_subheadername.Items[i].Value.ToString() + ""; } else { subheader = subheader + "'" + "," + "" + "'" + cbl_subheadername.Items[i].Value.ToString() + ""; } } } if (itemheader.Trim() != "" && subheader.Trim() != "") { ds.Clear(); ds = d2.BindItemCodewithsubheader(itemheader, subheader); if (ds.Tables[0].Rows.Count > 0) { cbl_itemname.DataSource = ds; cbl_itemname.DataTextField = "item_name"; cbl_itemname.DataValueField = "item_code"; cbl_itemname.DataBind(); ddl_itemname1.DataSource = ds; ddl_itemname1.DataTextField = "item_name"; ddl_itemname1.DataValueField = "item_code"; ddl_itemname1.DataBind(); ddl_itemname1.Items.Insert(0, "Select"); if (cbl_itemname.Items.Count > 0) { for (int i = 0; i < cbl_itemname.Items.Count; i++) { cbl_itemname.Items[i].Selected = true; } txt_itemname.Text = "Item Name(" + cbl_itemname.Items.Count + ")"; } if (cbl_itemname.Items.Count > 5) { Panel1.Width = 300; Panel1.Height = 300; } } else { txt_itemname.Text = "--Select--"; } } else { ddl_itemname1.Items.Insert(0, "Select"); txt_itemname.Text = "--Select--"; } } catch { } }