private void RefreshData() { var data = imsdb.Suppliers.OrderByDescending(br => br.Id).ToList(); GridViewSupplier.DataSource = data; GridViewSupplier.DataBind(); }
protected void GridViewSupplier_RowEditing(object sender, GridViewEditEventArgs e) { GridViewSupplier.EditIndex = e.NewEditIndex; List <SupplierList> sList = (List <SupplierList>)Session["SupplierList"]; GridViewSupplier.DataSource = sList; GridViewSupplier.DataBind(); }
protected void BindGrid() { List <SupplierList> sList = PurchasingLogic.ListSuppliers(); GridViewSupplier.DataSource = sList; GridViewSupplier.DataBind(); Session["SupplierList"] = sList; }
protected void BtnSearch_Click(object sender, EventArgs e) { string temp = TxtSearch.Text; List <SupplierList> sList = purchasing.SearchBy(temp); GridViewSupplier.DataSource = sList; GridViewSupplier.DataBind(); Session["SupplierList"] = sList; }
protected void loadSuppliers() { var conn = new MySqlConnection(strcon); string getdata = ""; if (DropDownContactName.SelectedIndex != 0) { getdata = "SELECT * FROM Supplier INNER JOIN Contact ON Supplier.SupId = Contact.SupId WHERE Contact.ContactId ='" + DropDownContactName.SelectedValue + "'"; } else if (DropDownSubCategory.SelectedIndex != 0 && DropDownSupplier.SelectedIndex != 0) { getdata = "SELECT * FROM Supplier INNER JOIN Contact ON Supplier.SupId = Contact.SupId WHERE Supplier.SupId IN (SELECT Supplier.SupId FROM Supplier INNER JOIN SubCatSupplier ON Supplier.SupId = SubCatSupplier.SupId INNER JOIN SubCategory ON SubCatSupplier.SubCatId = SubCategory.SubCatId WHERE SubCatSupplier.SubCatId ='" + DropDownSubCategory.SelectedValue + "' AND Supplier.SupId = '" + DropDownSupplier.SelectedValue + "' AND SubCatSupplier.SupId = Supplier.SupId) AND Contact.Main = 1"; } else if (DropDownSupplier.SelectedIndex != 0) { getdata = "SELECT * FROM Supplier INNER JOIN Contact ON Supplier.SupId = Contact.SupId WHERE Supplier.SupId = '" + DropDownSupplier.SelectedValue + "'"; } else { getdata = "SELECT * FROM Supplier INNER JOIN Contact ON Supplier.SupId = Contact.SupId WHERE Supplier.SupId IN (SELECT Supplier.SupId FROM Supplier INNER JOIN SubCatSupplier ON Supplier.SupId = SubCatSupplier.SupId INNER JOIN SubCategory ON SubCatSupplier.SubCatId = SubCategory.SubCatId WHERE SubCatSupplier.SubCatId ='" + DropDownSubCategory.SelectedValue + "' AND SubCatSupplier.SupId = Supplier.SupId) AND Contact.Main = 1 "; } conn.Open(); var cmd = new MySqlCommand(getdata, conn); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); int count = ds.Tables[0].Rows.Count; if (ds.Tables[0].Rows.Count > 0) { GridViewSupplier.DataSource = ds; GridViewSupplier.DataBind(); } else { //ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GridViewSupplier.DataSource = ds; GridViewSupplier.DataBind(); //int columncount = GridViewSupplier.Rows[0].Cells.Count; } }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["typeid"].ToString() != "1") { Response.Redirect("~/Login/Login.aspx"); } } catch (Exception) { Response.Redirect("~/Login/Login.aspx"); } if (!IsPostBack) { var data = imsdb.Suppliers.OrderByDescending(b => b.Id).ToList(); GridViewSupplier.DataSource = data; GridViewSupplier.DataBind(); } }
//___________________________________SUPPLIER_________________________________________________________________________________// private void BindDataSupplier() { Site site = (Site)Session["site"]; if (site != null) { List <Supplier> list = SupplierBll.LoadAllSupplier(site); if (list.Count() < 1) { list.Add(new Supplier()); } GridViewSupplier.DataSource = list; GridViewSupplier.DataBind(); GridViewSupplier.SelectedIndex = -1; } else { GridViewSupplier.DataSource = null; GridViewSupplier.DataBind(); lbl.Text = "Choisissez un SITE"; } }
void BindGrid(List <SupplierList> sList) { GridViewSupplier.DataSource = sList; GridViewSupplier.DataBind(); }