Tuesday, 11 December 2007

Tip - Making your LINQ datasource do all the work for you

One of the important things to remember when trying to get your LINQ datasources to do 2-way binding is to set the "EnableInsert" and "EnableUpdate" attributes to true. Otherwise, nothing will be inserted/updated when you click on the Edit/Insert link in your bound control (e.g. Telerik RadGrid)

   1:      <asp:LinqDataSource ID="OdsRiskManagementDataSource" runat="server" 
   2:          ContextTypeName="LendLease.MRP.Service.Persistence.Entity.MRPDataContext" EnableUpdate="true" EnableInsert="true"    
   3:          TableName="ODS_Risk_Managements">
   4:      </asp:LinqDataSource>    

No comments: