Ticket Q180873
Visible to All Users

LinqDataSource does not support the Select property when the Delete, Insert or Update operations are enabled.

created 17 years ago

I have a detail grid which I'm feedling via a LinqDataSource.
The reason I'm using a LinqDataSource and not a LinqServerModeDataSource is because the latter doesn't allow you to specify parameters for the Where clause declaratively. I'm getting the primary key from the master row and stuffing it into a session variable, which the detail table's data source then uses as its search parameter.
So far, so good, and it works.
However, when a new row is inserted, the error "LinqDataSource [name of my datasource] does not support the Select property when the Delete, Insert or Update operations are enabled."
Question: what is the "correct" way to use Linq to get detail rows (hopefully declaratively) so they can be updated?
Thanks,
Peter

Comments (2)
DevExpress Support Team 17 years ago

    Hi,
    To implement master detail ASPxGridView bound to a LinqServerModeDataSource, it is necessary to use its Selecting event and pass an IQueryable object which will define the data that should be queried from the data base for a certain detail ASPxGridView. To support data editing, you should set LinqServerModeDataSource.EnableEdit(EnableInsert, EnableDelete) properties to true. Also, set the DataContext's ObjectTrackingEnabled property value to false. Attached sample project shows this approach in action. NOTE: this project will not work online, so to test it, you should download it, change the connection string in the web.config file and run it on your local machine
    Thanks,
    Plato

      Ok - many thanks for that Plato - seems to work well and is pretty straightforward.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.