LinqDataSource.EnableDelete 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
LinqDataSource 컨트롤을 통해 데이터 레코드를 삭제할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.
public:
property bool EnableDelete { bool get(); void set(bool value); };
public bool EnableDelete { get; set; }
member this.EnableDelete : bool with get, set
Public Property EnableDelete As Boolean
속성 값
자동 삭제 작업을 사용하면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.
구현
예제
다음 예제에서는 .로 LinqDataSource 설정된 컨트롤을 EnableDelete 보여 주는 예제 true입니다. DetailsView 컨트롤은 데이터를 표시하고 사용자가 데이터 레코드를 삭제할 수 있는 단추를 만듭니다.
<asp:LinqDataSource
ContextTypeName="ExampleDataContext"
TableName="Products"
EnableUpdate="true"
EnableInsert="true"
EnableDelete="true"
ID="LinqDataSource1"
runat="server">
</asp:LinqDataSource>
<asp:DetailsView
DataKeyNames="ProductID"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateInsertButton="true"
AllowPaging="true"
DataSourceID="LinqDataSource1"
ID="GridView1"
runat="server">
</asp:DetailsView>
<asp:LinqDataSource
ContextTypeName="ExampleDataContext"
TableName="Products"
EnableUpdate="true"
EnableInsert="true"
EnableDelete="true"
ID="LinqDataSource1"
runat="server">
</asp:LinqDataSource>
<asp:DetailsView
DataKeyNames="ProductID"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateInsertButton="true"
AllowPaging="true"
DataSourceID="LinqDataSource1"
ID="GridView1"
runat="server">
</asp:DetailsView>
설명
사용자가 컨트롤을 EnableDelete true 통해 LinqDataSource 데이터 레코드를 삭제할 수 있도록 하려는 경우에 속성을 설정합니다. 이 경우 EnableDelete 컨트롤은 LinqDataSource trueLINQ to SQL 사용하여 자동으로 데이터를 삭제하는 명령을 만듭니다. 사용자가 컨트롤과 같이 삭제할 레코드를 선택할 수 있는 인터페이스를 DetailsView 포함해야 합니다.
LinqDataSource 속성 또는 GroupBy 속성이 설정된 경우 Select 컨트롤은 자동 삭제 작업을 지원하지 않습니다. 이 경우 LinqDataSource 삭제 작업을 시도하면 컨트롤이 예외를 throw합니다.