I have an issue with the conditional display of the formview edit button after a partial postback triggered by the formview control. I have an edit button defined in the ItemTemplate like this:
<asp:FormView ID="fvGenericDetails" runat="server">
<ItemTemplate>
<asp:Button ID="btnEditGenericDetails" runat="server" Visible="false" CausesValidation="False" CssClass="prepend-top" CommandName="Edit" Text="Edit Generic Details" />
</ItemTemplate>
The button is conditionally displayed based on user privilages in the page load event:
If CurrentUser.HasAdminStatus and fvGenericDetails.CurrentMode = FormViewMode.ReadOnly Then
Dim btnEditGenericDetails As Button = CType(Me.fvGenericDetails.FindControl("btnEditGenericDetails"), Button)
btnEditGenericDetails.Visible = True
End If
The problem I'm having is that as the formview control is in an UpdatePanel, the partial postback does not trigger the page load event when the control goes back to read-only mode, and the edit button is not made visible. What event should I be using to allow for this partial postback?
Edit: Having debugged the page, after the partial postback, the page does indeed hit the page_load event but the formview.currentmode = edit :|
I've tried using the ModeChanged event without success. Is the answer just not to use the formview control?
Thanks :)