private void populateGridViewProductDetail() { ProductService.serProduct stock = new ProductService.serProduct(); DataSet dataset = stock.Product_GetStock(); // 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 GridViewProductDetails.DataSource = dataset; // Bind values to controls rows and columns GridViewProductDetails.DataBind(); // Set control visible GridViewProductDetails.Visible = true; } else { //lbErrorViewPBI.Text = "Sql sentence was not successful."; } }
protected void BindData() { DataTable dt = ((DataSet)Session["ds"]).Tables[0]; //DataSet ds = ((DataSet)Session["ds"]); //DataTable dt.Tables[0]; GridViewProductDetails.DataSource = ds.Tables[0]; GridViewProductDetails.DataBind(); for (int i = 0; i < GridViewProductDetails.Rows.Count; i++) { // GridViewProductDetails.Rows[i].Cells[4].FindControl("DropDownListNoOfItems").visible = false; DropDownList noOfItems = (DropDownList)GridViewProductDetails.Rows[i].FindControl("DropDownListNoOfItems"); noOfItems.Visible = false; } }