protected void btnEditJoueurName_Click(object sender, EventArgs e) { try { PROP.PROPJoueur Joueur = new PROP.PROPJoueur(); //Joueur.Id = Convert.ToInt16(ddlJoueur.SelectedValue); //Joueur.Nom = txtEditJoueurName.Text; BALJoueur balJoueur = new BALJoueur(); bool result = balJoueur.updateJoueur(Joueur); if (!result) { Page.RegisterClientScriptBlock("message", "<script>alert('Invalid Inputs for update.')</script>"); } else { Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is updated successfully.')</script>"); binding(null); //ddlJoueur.SelectedIndex = 0; //txtEditJoueurName.Text = string.Empty; } } catch (Exception ex) { clsLogging logError = new clsLogging(); logError.WriteLog(ex); } }
protected void gvJoueurList_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { PROP.PROPJoueur Joueur = new PROP.PROPJoueur(); //int userid = Convert.ToInt32(gvJoueurList.DataKeys[e.RowIndex].Value.ToString()); GridViewRow row = (GridViewRow)gvJoueurList.Rows[e.RowIndex]; Label lblID = (Label)row.FindControl("lblID"); //TextBox txtname=(TextBox)gr.cell[].control[]; TextBox txtId = (TextBox)row.Cells[2].Controls[0]; TextBox txtName = (TextBox)row.Cells[3].Controls[0]; TextBox txtPrenom = (TextBox)row.Cells[4].Controls[0]; //TextBox textadd = (TextBox)row.FindControl("txtadd"); //TextBox textc = (TextBox)row.FindControl("txtc"); gvJoueurList.EditIndex = -1; Joueur.Id = int.Parse(txtId.Text); Joueur.Nom = txtName.Text; Joueur.Prenom = txtPrenom.Text; BALJoueur balJoueur = new BALJoueur(); bool result = balJoueur.updateJoueur(Joueur); if (!result) { Page.RegisterClientScriptBlock("message", "<script>alert('Invalid Inputs for update.')</script>"); } else { Page.RegisterClientScriptBlock("message", "<script>alert('Joueur is updated successfully.')</script>"); binding(null); //ddlJoueur.SelectedIndex = 0; //txtEditJoueurName.Text = string.Empty; } } catch (Exception ex) { clsLogging logError = new clsLogging(); logError.WriteLog(ex); } }