Bonjour, je poste une deuxième fois car j'ai un peu avancé sur mon problème

Itemplate, gridView et RowUpdating

J'ai donc travailler sur mon template qui donne à présent ceci :
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    private class MyTemplate : ITemplate
    {
        SncfEntitesCollection<Control> _templateControls;
        ListItemType _itemType;
        string _fieldName;
        string _controlType;
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="attribut"></param>
        /// <param name="edit"></param>
        public MyTemplate(SncfEntitesCollection<Control> templateControls)
        {
            _controlType = "data";
            _templateControls = templateControls;
            _itemType = ListItemType.Separator;
        }
        public MyTemplate(ListItemType itemType, string field_name, string control_type)
        {
            _itemType = itemType;
            _fieldName = field_name;
            _controlType = control_type;
        }
 
        #region ITemplate Members
        /// <summary>
        /// 
        /// </summary>
        /// <param name="container"></param>
        public void InstantiateIn(Control container)
        {
            if (_controlType == "data")
            {
                #region controlType = Data
                foreach (Control control in _templateControls)
                {
                    Control ctrl = CloneControl((Control)control);
                    //                
                    if (ctrl.GetType().Name == "DropDownList")
                    {
                        ((DropDownList)ctrl).AppendDataBoundItems = true;
                        ListItem item = new ListItem("", "");
                        ((DropDownList)ctrl).Items.Add(item);
                    }
                    container.Controls.Add(ctrl);
                }
                #endregion
            }
            else if (_controlType == "CommandField")
            {
                #region controlType = command
                switch (_itemType)
                {
                    case ListItemType.Header:
                        #region Header
                        Literal header_ltrl = new Literal();
                        header_ltrl.Text = "<b>" + _fieldName + "</b>";
                        container.Controls.Add(header_ltrl);
                        break;
                        #endregion
                    case ListItemType.Footer:
                        #region Footer
                        ImageButton insert_button = new ImageButton();
                        insert_button.ID = "insert_button";
                        insert_button.ImageUrl = "~/images/grid/group1/add.gif";
                        insert_button.CommandName = "Edit";
                        insert_button.ToolTip = "Insert";
                        //insert_button.Click += new ImageClickEventHandler(insert_button_Click);
                        container.Controls.Add(insert_button);
                        break;
                        #endregion
                    case ListItemType.Item:
                        #region Item
                        ImageButton edit_button = new ImageButton();
                        edit_button.ID = "edit_button";
                        edit_button.ImageUrl = "~/images/grid/group1/edit.gif";
                        edit_button.CommandName = "Edit";
                        //edit_button.Click += new ImageClickEventHandler(gvBareme_RowEditing);
                        edit_button.ToolTip = "Edit";
                        container.Controls.Add(edit_button);
                        /*Similarly, add button for delete just set its
                         command to equal to "Delete." It is important to know when
                         "insert" button is added, its CommandName is set to "Edit" like
                         that of the "edi" button because we want the GridView to enter into
                         Edit mode and this time we also want the text boxes for corresponding fields
                         empty*/
                        break;
                        #endregion
                    case ListItemType.EditItem:
                        #region EditItem
                        ImageButton update_button = new ImageButton();
                        update_button.ID = "update_button";
                        update_button.CommandName = "Update";
                        update_button.ImageUrl = "~/images/grid/group1/save.gif";
                        update_button.ToolTip = "Enregistrer les modifications";
                        update_button.OnClientClick = "return confirm('Êtes-vous sure de vouloir enregistrer vos modifications?')";
                        container.Controls.Add(update_button);
 
                        ImageButton cancel_button = new ImageButton();
                        cancel_button.ID = "cancel_button";
                        cancel_button.CommandName = "Cancel";
                        cancel_button.ImageUrl = "~/images/grid/group1/cancel.gif";
                        cancel_button.ToolTip = "Annuler les modifications";
                        container.Controls.Add(cancel_button);
 
                        break;
                        #endregion
                }
                #endregion
            }
 
        }
        #endregion
 
        /// <summary>
        /// Cette fonction permet de cloner un control web
        /// </summary>
        /// <param name="src_ctl">Control à cloner</param>
        /// <returns>Retourne un clone du control</returns>
        private Control CloneControl(System.Web.UI.Control src_ctl)
        {
            Type t = src_ctl.GetType();
            Object obj = Activator.CreateInstance(t);
            Control dst_ctl = (Control)obj;
            PropertyDescriptorCollection src_pdc = TypeDescriptor.GetProperties(src_ctl);
            PropertyDescriptorCollection dst_pdc = TypeDescriptor.GetProperties(dst_ctl);
 
            for (int i = 0; i < src_pdc.Count; i++)
            {
 
                if (src_pdc[i].Attributes.Contains(DesignerSerializationVisibilityAttribute.Content))
                {
 
                    object collection_val = src_pdc[i].GetValue(src_ctl);
                    if ((collection_val is IList) == true)
                    {
                        foreach (object child in (IList)collection_val)
                        {
                            Control new_child = CloneControl(child as Control);
                            object dst_collection_val = dst_pdc[i].GetValue(dst_ctl);
                            ((IList)dst_collection_val).Add(new_child);
                        }
                    }
                }
                else
                {
                    try { dst_pdc[src_pdc[i].Name].SetValue(dst_ctl, src_pdc[i].GetValue(src_ctl)); }
                    catch { }
                }
            }
 
            return dst_ctl;
 
        }
    }
Pour faire ensuite dans l'init de ma page :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
        TemplateField BtnTmpField = new TemplateField();
        BtnTmpField.HeaderTemplate = new MyTemplate(ListItemType.Header, "...", "CommandField");
        BtnTmpField.ItemTemplate = new MyTemplate(ListItemType.Item, "...", "CommandField");
        BtnTmpField.EditItemTemplate = new MyTemplate(ListItemType.EditItem, "...", "CommandField");
        BtnTmpField.FooterTemplate = new MyTemplate(ListItemType.Footer, "...", "CommandField");
        gvBareme.Columns.Add(BtnTmpField);
Mon gridView se présente ainsi :
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
    <cc1:InsertableGrid ID="gvBareme" runat="server" AutoGenerateColumns="False" 
        EmptyDataText="empty" 
        SkinID="InsertableGrid" 
        AllowInsert="True" 
        AllowPaging="True" 
        OnPageIndexChanging="gvBareme_PageIndexChanging" PageSize="20" 
 
        OnRowCreated="gvBareme_RowCreated"
        OnRowEditing="gvBareme_RowEditing"
        OnRowCancelingEdit="gvBareme_RowCancelingEdit" 
        OnRowUpdating="gvBareme_RowUpdating" 
        OnRowInserting="gvBareme_RowInserting"
        OnRowDeleting="gvBareme_RowDeleting" OnRowCommand="gvBareme_RowCommand"
        >
 
        <Columns>
 
        </Columns>
        <PagerSettings Mode="NumericFirstLast" />
 
    </cc1:InsertableGrid>
Problème : lors de l'execution, le traitement ne passe pas dans mes méthodes gvBareme_RowCancelingEdit, gvBareme_RowUpdating & co (il n'y a que l'Edit qui semble fonctionner)

Avez vous une idée pour résoudre mon problème ?

je vous en remercie par avance