Bonjour,
Je souhaite pouvoir modifier un enum (OUI ou NON) dans un gridview, j'ai donc dans mon aspx :
et dans le code c# j'ai :
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 <SharePoint:SPGridView EditRowStyle-BackColor="LightBlue" AutoGenerateColumns="false" ID="SPGrid1" runat="server" OnRowEditing="SPGrid1_RowEditing" OnRowCancelingEdit="SPGrid1_RowCancelling" OnRowDeleting="SPGrid1_RowDeleting" RowStyle-BackColor="#DDDDDD" AlternatingRowStyle-BackColor="#EEEEEE" GridLines="Both"> <Columns> <asp:TemplateField HeaderText="Action"> <ItemTemplate> <asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" /> <br /> <asp:LinkButton ID="btnDelete" OnClientClick="return ConfirmerSuppressionList();" Text="Delete" runat="server" CommandName="Delete" /> </ItemTemplate> <EditItemTemplate> <asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update" /> <asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" /> </EditItemTemplate> </asp:TemplateField> ... <asp:TemplateField HeaderText="Suppression"> <ItemTemplate> <asp:Label runat="server" ID="EXPSuppression" Text='<%#Eval("EXPSuppression") %>' /> </ItemTemplate> <EditItemTemplate> <asp:RadioButtonList ID="SuppressionRadioButtonList" runat="server" RepeatDirection="Vertical" SelectedValue='<%#Eval("EXPSuppression") %>' > <asp:ListItem Text="Oui" Value="Oui" /> <asp:ListItem Text="Non" Value="Non" /> </asp:RadioButtonList> </EditItemTemplate> </asp:TemplateField> </Columns> </SharePoint:SPGridView>
La valeur "text" vaut toujours "NON" quelque soit la valeur cochée (la valeur est toujours la valeur initiale).
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 protected override void CreateChildControls() { base.CreateChildControls(); SPGrid1.RowUpdating += SPGrid1_RowUpdating; } ... protected void SPGrid1_RowUpdating(object sender, GridViewUpdateEventArgs e) { RadioButtonList supprList = SPGrid1.Rows[e.RowIndex].FindControl("SuppressionRadioButtonList") as RadioButtonList; if (supprList.SelectedIndex > -1) { string text = supprList.SelectedItem.Text; } }
Avez-vous une idée d'où peut provenir le problème ?
Merci
Partager