Learn how to a build a cloud-first strategyRegister Now


Can't edit DataGridView

Posted on 2008-11-05
Medium Priority
Last Modified: 2013-11-08
In ASP.NET 3.5, I'm following this example: http://weblogs.asp.net/scottgu/archive/2007/07/16/linq-to-sql-part-5-binding-ui-using-the-asp-linqdatasource-control.aspx.  My LINQ source is coming from a DLL that I reference by project, in my asp.net app project.  In the datasource, I select the Advanced button allow LINQ to control edits and inserts.  I don't get the edit/inset options in the grid's smart tag until I select "*" in the datasource.  If I select a single column, the edit/insert options aren't in the smart tag.  What causes that?

Also, how can I make the insert option appear in the grid?
Question by:brettr
1 Comment
LVL 29

Accepted Solution

QPR earned 2000 total points
ID: 22915572
In order to allow edits/deletes your datasource must contain the primary key column for that table.
This way the IDE can create the SQL statements required for updates/deletes

otherwise we end up with....
Update myTable setColumn1 = "HelloWorld" where ?????

If the datasource contains the primary key (say myID) then the statement becomes
Update myTable setColumn1 = "HelloWorld" where myID = <value>

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 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