Allow editing in Linq to SQL Datagridview

Posted on 2011-04-26
Last Modified: 2012-05-11
Using L2Q I fill a datagridview with records.  One column has checkboxes that I want the user to check if the record is to be deleted.  However, the dgv does not allow the box to be checked.  The error says it is read only.   What do I need to do to allow editing?
Dim currBDocs = From d In db.Documents Order By d.LastModifiedDate Ascending _
                      Select d.DocID, d.LastModifiedDate, d.DocTitle, d.DeleteFromDB

        dgvBDocs.DataSource = currBDocs

Open in new window

Thanks for any help on this.
Question by:McGurk1
    1 Comment
    LVL 83

    Accepted Solution

    You would have to handle the updating manually. This is especially true when you have a Select list in the LINQ query because that creates an anonymous type.

    I think for gridviews, you would be better off using stored procedures.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now