<asp:DetailsView Width="750" runat="server" ID="ctlApplicationEdit" DefaultMode="Edit" DataSourceID="applicationDataSourceDetails" DataKeyNames="ID" AutoGenerateRows="false" CssClass="EditApplicationWindow" OnModeChanged="OnApplicationChanged">
<Fields>
<!-- Does not work as expected: (Delete button is not shown) -->
<asp:CommandField ButtonType="Button" ShowEditButton="true" ShowDeleteButton="true" />
<!-- Works as expected: (Delete button is shown and calls the delete method when pressed)-->
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:Button ID="deleteButton" runat="server" CommandName="Delete" Text="Delete"/>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
ObjectDataSource에 DeleteMethod
을 설정했으며 이는 TemplateField
에서 예상대로 작동합니다.삭제 버튼이 표시되지 않는 이유는 무엇입니까?
내 질문 : 왜 명령 필드에는 취소 및 업데이트 버튼 만 표시되지만 삭제되지 않는 이유는 무엇입니까? 어떤 상황에서 이것이 일어날까요?