protected void activeLB_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; ClassesM.UpdateActivation("ACTIVATION", Int32.Parse(lb.CommandArgument)); BindGrid(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox nom_classe = (TextBox)GridView1.Rows[e.RowIndex].FindControl("nom_classeEDIT"); Label id_classe = (Label)GridView1.Rows[e.RowIndex].FindControl("id_classe"); FileUpload imgFU = (FileUpload)GridView1.Rows[e.RowIndex].FindControl("imgFU"); Classe c = new Classe(); c.Id = Int32.Parse(id_classe.Text); c.ImgURL = imgFU.FileName; c.Name = nom_classe.Text; if (imgFU.FileName != "" && (imgFU.FileName.Contains(".jpg") || imgFU.FileName.Contains(".png"))) { ClassesM.UpdateClasse(c); GridView1.EditIndex = -1; BindGrid(); } else { Response.Write("<script>alert('Please select an image (.jpg or .png)');</script>"); } }
protected void BindGrid() { GridView1.DataSource = ClassesM.SelectClasses(); GridView1.DataBind(); }