views:

34

answers:

1

I have an accounts table in my database (firstname, lastname, address, etc) and I need to display that on my asp.net page, BUT i need to enable editing also.

I have tried using GridView, DetailsView etc, and none of them seem to enable editing? I am sure i am doing something wrong.

I am using linqdatasource which connects to my repository.

<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>

any ideas. thanks

A: 

You have to explicitly enable update, insert, and delete on the datasource:

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