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”即可按预期工作。 –