Bonjour à tous,

Je n'arrive pas à changer le mode de mon detailsView lorsque je clique sur le bouton commmande "Modifier"

Voici mon detailsView:
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
 
 
 
        <div style="left: 303px; width: 50%; position: absolute; top: 189px; height: 50%">
            <asp:DetailsView ID="DetailsView1" runat="server" CellPadding="4" ForeColor="#333333" Width="585px" Height="392px" OnItemCommand="DetailsView1_ItemCommand" OnModeChanging="DetailsView1_ModeChanging">
                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
                <EditRowStyle BackColor="#7C6F57" />
                <RowStyle BackColor="#E3EAEB" />
                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                <Fields>
                    <asp:CommandField ButtonType="Button" ShowEditButton="True" ShowSelectButton="True"/>
                </Fields>
                <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="White" />
            </asp:DetailsView>
        </div>
Et voici les deux fonctions (une des deux devrait suffir) associées :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
 
    protected void DetailsView1_ModeChanging(object sender, DetailsViewModeEventArgs e)
    {
        e.NewMode = DetailsViewMode.Edit;
    }
    protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
    {
        DetailsView1.DefaultMode = DetailsViewMode.Edit;
    }

Le mode reste toujours en readOnly

Pourquoi ??

Meric pour votre aide !!