protected void GetArticle_SelectedIndexChanged(object sender, EventArgs e) { GetPo.Items.Clear(); GetPo.Items.Add(new ListItem("-", "")); GetPo.AppendDataBoundItems = true; SqlConnection conn = new SqlConnection(DbConnect.x); try { DataTable dt = new DataTable(); String strQuery = "select distinct a.po_no,b.gmtyp as art_item,b.gmtid,a.Fact_nm from view_Article_Po a join GarmentsType b on a.art_item = b.gmtid where art_no='" + GetArticle.SelectedItem.Value + "' and a.po_no not in (select Po_no from Line_Booking) "; SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = strQuery; cmd.Connection = conn; conn.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); if (dt.Rows.Count > 0) { //If you want to get mutiple data from the database then you need to write a simple looping GetGType.Text = dt.Rows[0]["art_item"].ToString(); GetFactory.Text = dt.Rows[0]["Fact_nm"].ToString(); Session["GType"] = GetGType.Text; Session["GTypeId"] = dt.Rows[0]["gmtid"]; GetPo.ClearSelection(); GetPo.DataTextField = "po_no"; GetPo.DataValueField = "po_no"; GetPo.DataSource = dt; GetPo.DataBind(); } } catch (Exception ex) { throw ex; } finally { conn.Close(); conn.Dispose(); } }
protected void GetStyle_SelectedIndexChanged(object sender, EventArgs e) { GetPo.Items.Clear(); GetPo.Items.Add(new ListItem("-", "")); GetPo.AppendDataBoundItems = true; SqlConnection conn = new SqlConnection(DbSpecFo.x); String strQuery1 = "select sm.cStyleNo,om.cPoNum from Smt_OrdersMaster om join Smt_StyleMaster sm on om.nOStyleId=sm.nStyleID where cStyleNo='" + GetStyle.SelectedItem.Text + "' "; SqlCommand cmd1 = new SqlCommand(); cmd1.CommandType = CommandType.Text; cmd1.CommandText = strQuery1; cmd1.Connection = conn; try { conn.Open(); GetPo.DataSource = cmd1.ExecuteReader(); GetPo.DataTextField = "cPoNum"; GetPo.DataBind(); if (GetPo.Items.Count > 1) { GetPo.Enabled = true; } else { GetPo.Enabled = false; } } catch (Exception ex) { throw ex; } finally { conn.Close(); conn.Dispose(); } }
protected void ddlStyle_SelectedIndexChanged(object sender, EventArgs e) { GetPo.Items.Clear(); GetPo.Items.Add(new ListItem("-", "")); GetPo.AppendDataBoundItems = true; SqlConnection conn = new SqlConnection(DbConnect.x); String strQuery1 = "select art_no from tblBookCAD where ord_no='" + ddlStyle.SelectedItem.Text + "' "; SqlCommand cmd1 = new SqlCommand(); cmd1.CommandType = CommandType.Text; cmd1.CommandText = strQuery1; cmd1.Connection = conn; try { conn.Open(); GetPo.DataSource = cmd1.ExecuteReader(); GetPo.DataTextField = "art_no"; GetPo.DataBind(); if (GetPo.Items.Count > 1) { GetPo.Enabled = true; } else { GetPo.Enabled = false; } } catch (Exception ex) { throw ex; } finally { conn.Close(); conn.Dispose(); } }