C#: Formview doesn't change Mode
- by Vinzcent
Hey
When I try to change my formview to Edit, he stays in de ReadOnlyMode. I can't figure out why.
This is my code.
<asp:FormView ID="fvDetailOrder" runat="server" AllowPaging="True" DataKeyNames="ID" OnModeChanging="fvDetailOrder_ModeChanging">
<EditItemTemplate>
// I want to see this, when I click edit
<asp:LinkButton ForeColor="#003366" ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ForeColor="#003366" ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
Insert here
<asp:LinkButton ForeColor="#003366" ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ForeColor="#003366" ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Read only
<asp:LinkButton ForeColor="#003366" ID="EditButton" runat="server" CausesValidation="False"
CommandName="Edit" Text="Edit" />
<asp:LinkButton ForeColor="#003366" ID="DeleteButton" runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you certain you want to delete this product?');" />
<asp:LinkButton ForeColor="#003366" ID="NewButton" runat="server" CausesValidation="False"
CommandName="New" Text="New" />
</ItemTemplate>
<PagerStyle ForeColor="#003366" />
</asp:FormView>
Eventhandler
protected void fvDetailOrder_ModeChanging(Object sender, FormViewModeEventArgs e)
{
fvDetailOrder.ChangeMode(e.NewMode);
}
Thanks, Vincent