1
我有查看和編輯模式的一個FormView,在一個UpdatePanel:取消FormView的編輯模式?
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:FormView runat="Server" DefaultMode="ReadOnly" DataSourceID="_myDataSource" >
<ItemTemplate>
<!-- View controls omitted -->
<asp:Button runat="server" CommandName="Edit" Text="Edit" />
</ItemTemplate>
<EditItemTemplate>
<!-- Edit controls omitted -->
<asp:Button runat="server" CommandName="Update" Text="Save" />
<asp:Button runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
</EditItemTemplate>
</asp:FormView>
</ContentTemplate>
</asp:UpdatePanel>
<!-- Data source (may attributes omitted) -->
<asp:ObjectDataSource ID="_myDataSource" runat="server" />
的Edit
和Update
按鈕/命令做工精細,但Cancel
按鈕什麼都不做。
任何想法?
單擊取消按鈕後,FormView將從編輯模式中跳出。那麼你想要取消按鈕做什麼? –
這就是我想要的,但它什麼都不做。甚至沒有回傳。 「編輯」和「更新」按鈕只需設置「CommandName」即可按預期工作。 –