private void AddPurch_Load(object sender, EventArgs e) { var BookIDs = string.Join(",", CartPointer.Select(x => x.ToString()).ToArray()); if (String.IsNullOrEmpty(BookIDs)) { DataTable dt = new DataTable(); BuyGridView.DataSource = dt; BuyGridView.Refresh(); PriceLabel.Text = "0"; return; } var BookIDStr = "( " + BookIDs + " )"; DataTable DisplayTable = ControlObj.DisplayCart(BookIDStr); string TotalSalePrice = Convert.ToString(DisplayTable.Compute("Sum(Price)", "")); PriceLabel.Text = TotalSalePrice; BuyGridView.DataSource = DisplayTable; BuyGridView.Refresh(); }