protected void FillUsers() { using (PTCLEntities db = new PTCLEntities()) { var Users = db.GetPtclUsers().ToList(); GVCustomers.DataSource = Users; GVCustomers.DataBind(); GVCustomers.UseAccessibleHeader = true; if (GVCustomers.Rows.Count > 0) { GVCustomers.HeaderRow.TableSection = TableRowSection.TableHeader; } else { lblCustomersMsg.Text = "No Record to Show"; } } }
protected void Page_Load(object sender, EventArgs e) { HyperLink activeHyp = Master.FindControl("HypDashBoard") as HyperLink; activeHyp.CssClass += " active"; using (PTCLEntities db = new PTCLEntities()) { if (Session["AdminID"] != null) { var totalCustomerCount = db.GetPtclUsers().ToList(); int counCustomer = totalCustomerCount.Count; lblTotalCustomers.Text = counCustomer.ToString(); var totalAdminCount = db.GetPtclAdmins().ToList(); int counAdmins = totalAdminCount.Count; LblTotalAdmins.Text = counAdmins.ToString(); var totalComplaints = db.GetComplaints().ToList(); int mytotalComplaints = totalComplaints.Count; lblTotalComplaints.Text = mytotalComplaints.ToString(); } } }