protected void GvStaff_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     StaffAdapter.Delete(Convert.ToInt32(GvStaff.DataKeys[e.RowIndex].Value));
     StaffDT            = StaffAdapter.SelectStaff();
     GvStaff.DataSource = StaffDT;
     GvStaff.DataBind();
 }
        protected void GvStaff_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            StaffMst.Delete(Convert.ToInt32(GvStaff.DataKeys[e.RowIndex].Value));
            DataTable StaffDT = StaffMst.GetAllActiveData();

            GvStaff.DataSource = StaffDT;
            GvStaff.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         StaffDT            = StaffAdapter.SelectStaff();
         GvStaff.DataSource = StaffDT;
         GvStaff.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataTable StaffDT = StaffMst.GetAllActiveData();
         GvStaff.DataSource = StaffDT;
         GvStaff.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         DataTable StaffDT = StaffMst.GetAllActiveData();
         GvStaff.DataSource = StaffDT;
         GvStaff.DataBind();
         lblstaff.Text = GvStaff.Rows.Count.ToString();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         StaffDT            = StaffAdapter.SelectStaff();
         GvStaff.DataSource = StaffDT;
         GvStaff.DataBind();
         lblstaff.Text = GvStaff.Rows.Count.ToString();
     }
 }
        void RefreshGridView()
        {
            var Lecturers = ctx.Lecturers.Select(q => new
            {
                q.Lecturer_Id,
                q.First_Name,
                q.Middle_Name,
                q.Last_Name,
                q.Address,
                q.Gender.Gender1
            }).ToList();

            GvStaff.DataSource = Lecturers;
            GvStaff.Refresh();
        }
Exemple #8
0
        //show data in grid view
        public void show()
        {
            SqlConnection con   = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString);
            string        query = "select StaffId, StaffName, Email, Mobile, Qualification, Address from tblStaff";

            con.Open();
            SqlCommand cmd = new SqlCommand(query, con);

            cmd.ExecuteNonQuery();
            DataTable      dt  = new DataTable();
            SqlDataAdapter sda = new SqlDataAdapter(cmd);

            sda.Fill(dt);
            GvStaff.DataSource = dt;
            GvStaff.DataBind();
            con.Close();
        }