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