public void UpdateGridView()
        {
            SqlConnection conn   = new SqlConnection(@"data source = DESKTOP-VKU3EK5; integrated security = true; database = ExterminatorDB");
            SqlCommand    cmd    = null;
            SqlDataReader rdr    = null;
            string        sqlsel = "SELECT Request.RequestID, Customer.CustomerID, Customer.Firstname, Customer.Lastname, Pest.PestID, Pest.Name, Request.Date " +
                                   "FROM Request " +
                                   "INNER JOIN Customer ON Request.CustomerID = Customer.CustomerID " +
                                   "INNER JOIN Pest ON Request.PestID = Pest.PestID";

            try
            {
                conn.Open();

                cmd = new SqlCommand(sqlsel, conn);

                rdr = cmd.ExecuteReader();

                GridViewRequest.DataSource = rdr;

                GridViewRequest.DataBind();

                rdr.Close();
            }
            catch (Exception ex)
            {
                LabelMessage.Text = ex.Message;
            }
            finally
            {
                conn.Close();
            }
        }
        private void _refreshGrid(List <MakeNewRequestModel> models)
        {
            GridViewRequest.DataSource = models;
            GridViewRequest.DataBind();

            if (GridViewRequest.Rows.Count == 1)
            {
                (GridViewRequest.Rows[0].FindControl("btnRemoveRow") as Button).Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString);

            con.Open();
            string     username = Session["user"].ToString();
            SqlCommand cmd      = new SqlCommand("select ReqID, Purpose,StartTime,EndTime,StID,day from tblRequest r inner join tbl_Teacher t on t.TID=r.TID where UserName=@username", con);

            cmd.Parameters.AddWithValue("@username", username);
            SqlDataReader rdr = cmd.ExecuteReader();

            GridViewRequest.DataSource = rdr;
            GridViewRequest.DataBind();
            con.Close();
        }