Allow editing in Linq to SQL Datagridview

Posted on 2011-04-26
Medium Priority
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

CodeCruiser earned 2000 total points
ID: 35473710
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

864 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