protected void Page_Load(object sender, EventArgs e) { var db = new TravelExpertsEntities(); GridViewSuppliers.DataSource = db.Suppliers.ToList(); GridViewSuppliers.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString; SqlConnection con = new SqlConnection(CS); SqlCommand cmd = new SqlCommand("Get_Suppliers_Report", con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); GridViewSuppliers.DataSource = rdr; GridViewSuppliers.DataBind(); rdr.Close(); con.Close(); } }
protected void GridViewProducts_RowCommand(object sender, GridViewCommandEventArgs e) { PanelDetailedResult.Visible = true; PanelSuppliers.Visible = false; PanelProductDetails.Visible = false; PanelInitailResult.Visible = false; // Get the Selected product info int row_index = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; Product product = new Product(); product.P_name = GridViewProducts.Rows[row_index].Cells[0].Text; product.Mark = GridViewProducts.Rows[row_index].Cells[1].Text; product.Inch = Convert.ToDouble(GridViewProducts.Rows[row_index].Cells[2].Text); product.Style = GridViewProducts.Rows[row_index].Cells[3].Text; product.Purchase_Price = Convert.ToDouble(GridViewProducts.Rows[row_index].Cells[4].Text); product = product.Get_Product_info(); lblP_name.Text = product.P_name; lblMark.Text = product.Mark; lblStyle.Text = product.Style; lblInch.Text = product.Inch.ToString(); lblPurchase_Price.Text = product.Purchase_Price.ToString(); lblRegSellPrice.Text = product.Regulare_Price.ToString(); lblSpecialSellPrice.Text = product.Special_Price.ToString(); lblAmount.Text = product.Amount.ToString(); TxtDesc.Text = product.Description; if (RadioButtonListCategories.SelectedValue == "Tol") { PanelTol.Visible = true; PanelMotors.Visible = true; } else if (RadioButtonListCategories.SelectedValue == "Motors") { PanelTol.Visible = false; PanelMotors.Visible = true; } else { PanelTol.Visible = false; PanelMotors.Visible = false; } //get the product suppliers with the product key (name- price- mark- style- inch) GridViewSuppliers.DataSource = Suppliers_Products.Get_Specific_Product_Suppliers(product.P_name, product.Purchase_Price); GridViewSuppliers.DataBind(); }