Bonjour le forum
j'ai se code pour la suppression d'élément du panier
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
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
35
36
 
 DataTable dt = new DataTable();
            dt = (DataTable)Session["Buyitems"];
            for (int i = 0; i <= dt.Rows.Count - 1; i++)
            {
                Uid = Convert.ToInt32(lblNomUser.Text);
                int sr;
                int sr1;
                string qdata;
                string dtdata;
                sr = Convert.ToInt32(dt.Rows[i]["CID"].ToString());
                TableCell cell = GridView1.Rows[e.RowIndex].Cells[0];
                qdata = cell.Text;
                dtdata = sr.ToString();
                sr1 = Convert.ToInt32(qdata);
                TableCell prID = GridView1.Rows[e.RowIndex].Cells[1];
                if (sr == sr1)
                {
                    dt.Rows[i].Delete();
                    dt.AcceptChanges();
                    con.Open();
                    SqlCommand cmd = new SqlCommand("delete top(1) from [dbo].[tblCommandeClient] where [PID]='" + prID.Text + "' and [Uid]='" + Uid + "'", con);
                    cmd.ExecuteNonQuery();
                    con.Close();
                    break;
 
                }
 
            }
            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                dt.Rows[i - 1]["CID"] = i;
                dt.AcceptChanges();
            }
            Session["Buyitems"] = dt;
            Response.Redirect("Addtocart.aspx");
qui fonctionne bien avec un gridview
maintenant j'aimerais savoir comment modifier pour qu'elle fonctionne avec un repeater?