I have a problem with the conditional display of the form edit button after the partial postback caused by the form control. I have an edit button defined in 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 privileges 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 is that since the formview control is in the UpdatePanel, the partial postback does not raise the page load event when the control returns to read-only mode and the edit button does not become visible. What event should I use to enable this partial postback?
Edit: after debugging the page after partial postback, the page really falls into the page_load event, but formview.currentmode = edit: |
I tried to use the ModeChanged event without success. The answer is only not to use a form control?
Thanks:)
source
share