private void populateGridViewStock() { ProductService.serProduct stock = new ProductService.serProduct(); DataSet dataset = stock.Product_GetStock(); //string x = dataset.GetXml(); //Create a DataSet from Database if (dataset != null) { // A user can select a person from the grid //GridViewStock.AutoGenerateSelectButton = true; // Set the DataSet to cotrols DataSource GridViewStock.DataSource = dataset; // Bind values to controls rows and columns GridViewStock.DataBind(); // Set control visible GridViewStock.Visible = true; } else { //lbErrorViewPBI.Text = "Sql sentence was not successful."; } }
//Wenn seite geladen wird, die Liste der Stöcke abfüllen protected void Page_Load(object sender, EventArgs e) { UserH1.Text = "Welcome " + ((Benutzer)Session[0]).Username; using (var db = new WebshopDBContext()) { db.Unihockeystock.ToList().ForEach(s => StockListe.Add(s)); } GridViewStock.DataSource = StockListe; GridViewStock.DataBind(); }
//Wenn seite geladen wird, die Liste der Stöcke abfüllen protected void Page_Load(object sender, EventArgs e) { var waren = (List <string>)Session[1]; foreach (var item in waren) { using (var db = new WebshopDBContext()) { StockListe.Add(db.Unihockeystock.FirstOrDefault(u => u.UnihockeyStock.Equals(item))); } } GridViewStock.DataSource = StockListe; GridViewStock.DataBind(); }
// Code for Stock Investments view void FillGridStock() { if ((string)Session["AdminSessionID"] != null) { SqlDataAdapter GDA = new SqlDataAdapter(" " + " select Code,SchemeName,NoShare,PurchasePrice,CurrentPrice,InvestedAmount,CurrentValue,GainLoss " + " from fp_Investments where ProductName='Stock' and ClientCode=" + ViewState["xClientCode"] + " " + " ", Con); DataSet GDS = new DataSet(); Con.Open(); GDA.Fill(GDS); Con.Close(); GridViewStock.DataSource = GDS; GridViewStock.DataBind(); } else { Response.Redirect("SessionExpired.aspx"); } }