Bonjour,
J'ai une GV qui est chargée à partir d'une BDD.
Lorsque je clique sur le bouton Edit d'une ligne de mon GV, j'arrive à modifier les champs mais lorsque je clique sur Update, j'ai une erreur OutOfRange sur la ligne int myID = Convert.ToInt32(gv_db.DataKeys[e.RowIndex].Value);
Code ASP
Code C#
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30protected void gv_db_RowUpdating(object sender, GridViewUpdateEventArgs e) { // find student id of edit row //string id = gv_db.DataKeys[e.RowIndex].Value.ToString(); int myID = Convert.ToInt32(gv_db.DataKeys[e.RowIndex].Value); // find updated values for update TextBox id2 = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_id2"); TextBox BU = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_BU"); TextBox Country = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_Country"); TextBox Alpha2 = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_Alpha2"); TextBox Digital = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_Digital"); TextBox City = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_City"); TextBox State = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_State"); TextBox cp = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_cp"); TextBox UPN = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_UPN"); TextBox displayName = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_displayName"); TextBox o365 = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_o365"); TextBox vpn = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_vpn"); TextBox internet = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_internet"); TextBox OU = (TextBox)gv_db.Rows[e.RowIndex].FindControl("txt_OU"); DB.UpdateDBRef("SQL_UPDATE_1", myID, id2.Text, BU.Text, Country.Text, Alpha2.Text, Digital.Text, City.Text, State.Text, cp.Text, UPN.Text, displayName.Text, o365.Text, vpn.Text, internet.Text, OU.Text); gv_db.EditIndex = -1; gv_db.DataSource = DB.GetDBRef(); gv_db.DataBind(); }

 

 
		
		 
        

 
			
			




 GridView, RowUpdating -> OutOfRange
 GridView, RowUpdating -> OutOfRange
				 Répondre avec citation
  Répondre avec citation
Partager