protected void Page_Load(object sender, EventArgs e) { HyperLink activeHyp = Master.FindControl("HypReport") as HyperLink; activeHyp.CssClass += " active"; GVAdmin.UseAccessibleHeader = true; if (!IsPostBack) { GridFill(); } using (PTCLEntities db = new PTCLEntities()) { //object create if (IsPostBack == true) { return; } var MainCategory = db.GetPtclAdmins().ToList(); ddlAdmins.DataSource = MainCategory; ddlAdmins.DataTextField = "UserName"; ddlAdmins.DataValueField = "AdminID"; ddlAdmins.DataBind(); ddlAdmins.Items.Insert(0, new ListItem("--Select--", "0")); var SubCategory = db.spGetLocation().ToList(); ddlLocation.DataSource = SubCategory; ddlLocation.DataTextField = "LocationName"; ddlLocation.DataValueField = "LocationID"; ddlLocation.DataBind(); ddlLocation.Items.Insert(0, new ListItem("--Select--", "1")); } }
protected void FillAdmin() { using (PTCLEntities db = new PTCLEntities()) { var Admins = db.GetPtclAdmins().ToList(); GVAdmin.DataSource = Admins; GVAdmin.DataBind(); GVAdmin.UseAccessibleHeader = true; if (GVAdmin.Rows.Count > 0) { GVAdmin.HeaderRow.TableSection = TableRowSection.TableHeader; } else { lblAdminmsg.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(); } } }