private void BindGridView() { try { if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "Select idTest,nameTest,TestReduction from Tests;"; SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); GridViewTest.DataSource = ds; GridViewTest.DataBind(); lbltotalcount.Text = GridViewTest.Rows.Count.ToString(); } catch (SqlException ex) { showMessage(ex.Message); } finally { conn.Close(); } }
public void bindAllClaim() { string ss = "SELECT cpoint_name,COUNT(claim_id),claim_budget_year AS amount FROM tbl_cpoint LEFT JOIN tbl_claim ON claim_cpoint = cpoint_id WHERE claim_budget_year = '2561' GROUP BY claim_cpoint"; MySqlDataAdapter AllClaim = function.MySqlSelectDataSet(ss); DataGrid dt = new DataGrid(); GridViewTest.DataSource = dt; GridViewTest.DataBind(); }
public void display() { DataTable dt = new DataTable(); String con; con = "User Id = sandeep; Password=admin; Data source = XE"; cn.ConnectionString = con; cn.Open(); //to display data from department table OracleCommand cmd = new OracleCommand("Select * from Tests_Details", cn); OracleDataAdapter adp = new OracleDataAdapter(cmd); adp.Fill(dt); cn.Close(); GridViewTest.DataSource = dt; GridViewTest.DataBind(); }
protected void CalendarApproveLeaves_SelectionChanged(object sender, EventArgs e) { System.Data.DataView view = socialEvents.DefaultView; view.RowFilter = String.Format( "Req_Date >= #{0}# AND Req_Date < #{1}#", CalendarApproveLeaves.SelectedDate.ToShortDateString(), CalendarApproveLeaves.SelectedDate.AddDays(1).ToShortDateString() ); if (view.Count > 0) { GridViewTest.Visible = true; GridViewTest.DataSource = view; GridViewTest.DataBind(); } else { GridViewTest.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { LussisEntities context = new LussisEntities(); int SNO = (Convert.ToInt16(Request["SNO"])); var query = context.PURCHASEORDERVIEWs .Where(x => x.PONo == SNO); var purchaseOrderDetails = ViewReorderReportController.showPurchaseOrderDetails(SNO); var abc = purchaseOrderDetails.Select(x => new { ItemNo = x.ItemNo, Description = x.Description, Qty = x.Qty, UnitPrice = x.UnitPrice }); GridViewTest.DataSource = abc; GridViewTest.DataBind(); //filling up labels supplierNameLabel.Text = Convert.ToString(context.PurchaseOrders .Where(p => p.PONo == SNO) .FirstOrDefault().Supplier.SupplierName); poNumberLabel.Text = Convert.ToString(SNO); orderedByLabel.Text = Convert.ToString(context.PurchaseOrders .Where(p => p.PONo == SNO) .FirstOrDefault().Employee1.EmpName); datedLabel.Text = context.PurchaseOrders .Where(p => p.PONo == SNO) .FirstOrDefault().DateIssued.Value.ToString("dd MMM yyyy"); int empNo = (int)context.PurchaseOrders.Where(p => p.PONo == SNO).FirstOrDefault().ApprovedBy; approvedByLabel.Text = context.Employees.Where(x => x.EmpNo == empNo).First().EmpName; dated2Label.Text = context.PurchaseOrders .Where(p => p.PONo == SNO) .FirstOrDefault().DateReviewed.Value.ToString("dd MMM yyyy"); }
public void ShowTest() { GridViewTest.DataSource = testManager.GetAllTestWithType().OrderBy(x => x.Test); GridViewTest.DataBind(); }