在asp.net中编辑Linq到Sql的数据

问题描述:

我在我的数据库(名字,姓氏,地址等)中有一个帐户表,我需要在我的asp.net页面上显示,但我需要启用编辑也。在asp.net中编辑Linq到Sql的数据

我已经尝试过使用GridView,DetailsView等,他们都没有启用编辑?我确信我做错了什么。

我正在使用连接到我的存储库的linqdatasource。

<asp:LinqDataSource ID="AccountDataSource" runat="server" 
ContextTypeName="Model.Core.Domain.DBDataContext" 
Select="new (Summary, Department, JobTitle)" TableName="Accounts" 
Where="AccountId == @AccountId" EnableUpdate="True" > 
<WhereParameters> 
    <asp:SessionParameter Name="AccountId" SessionField="accountId" Type="Int32" /> 
</WhereParameters> 

任何想法。感谢

你必须明确地允许更新,插入和删除数据源:

<asp:LinqDataSource ID="AccountDataSource" runat="server" 
EnableUpdate="true" 
EnableInsert="true" 
EnableDelete="true" 
...